Fix an issue for computing the nth digit of a sequence.