The last digits of powers of a number repeats. For example the last digits of powers of 2 repeat in a cycle of 4, 8, 6, 2, 4, 8, 6, 2 and the last digits of powers of 9 repeat in a cycle of 1, 9, 1, 9. That is for 2, the repeat count is 4 and for 9 it is 2. In fact, the repeat count of all numbers ending with 2 is 4 and 9 is 2 which can be proved with binomial theorem. Hence the repeat count of any decimal number can be easily calculated from the repeat counts of first 9 numbers.
But I am looking for a solution to find repeat count of numbers with larger base/radix than decimal. Hence maintaining a complete lookup table is hard. Also is there a solution to find the repeat count if we consider n last digits instead of 1? In short, given a number, its base and howmany last digits, is it possible to find the repeat count?
So far I found Chinese Remainder Theorem and Euler’s Theorem to find last digits. But I couldn’t find a way through it to find the count. I have only basic knowledge in mathematics. I would be grateful for any help.