I have this odd math question from my brain's archives that I keep thinking about, so I'd like to put this thing to rest. Start with:
n 1 2 3 4 5 6 7 8 9
n mod 10 = 1 2 3 4 5 6 7 8 9
n^2 mod 10 = 1 4 9 6 5 6 9 4 1
n^3 mod 10 = 1 8 7 4 5 6 3 2 9
n^4 mod 10 = 1 6 1 6 5 6 1 6 1
n^5 mod 10 = 1 2 3 4 5 6 7 8 9
n^6 mod 10 = 1 4 9 6 5 6 9 4 1
n^7 mod 10 = 1 8 7 4 5 6 3 2 9
n^8 mod 10 = 1 6 1 6 5 6 1 6 1
n^9 mod 10 = 1 2 3 4 5 6 7 8 9
n^10 mod 10 = 1 4 9 6 5 6 9 4 1
n^11 mod 10 = 1 8 7 4 5 6 3 2 9
n^12 mod 10 = 1 6 1 6 5 6 1 6 1
n = 0 not shown, since 0 mod 10 = 0
n > 9 not shown either; my argument for that goes:
n > 9 = 10a + c
= (10a + c) mod 10,
but 10a mod 10 = 0, so
(10a + c) mod 10 = c
Restricting domain of n to 0 <= n <= 9 does not lose generality; going further would just loop the same sequence.
If I were to restrict myself to, say, n = 3 and then go down the table, this sequence appears:
a(x) = 3
x mod 10 =
3, 9, 7, 1, 3, 9, 7, 1, 3, 9, 7, 1
(I'm underlining the repeating section)
If I change it to mod 7 and just restrict myself to n = 6 and going down a table similar to that one (so n, n^2, n^3....), this happens:
b(x) = 6
x mod 7 =
6, 1, 6, 1, 6, 1...
repeats (or to give the more formal term, "is periodic")
Then if I go to mod 13 and n = 11:
c(x) = 11
x mod 13 =
11, 4, 5, 3, 7, 12, 2, 9, 8, 10, 6, 1, 11, 4, 5, 3, 7, 12, 2, 9, 8, 10, 6, 1, 11...
is also periodic.
This family of sequences (which I'll define later) sometimes fails to be periodic if the values of n and the modulus aren't coprime:
d(x) = 6
x mod 12 = 6, 0, 0, 0, 0, 0, 0, 0...
It is eventually periodic with a period of 1 (just remove the first term), so that's something.
And as for "sometimes", I'll just steal from the table:
e(x) = 5
x mod 10 =
5, 5, 5, 5, 5...
Why does it seem to be the case that, given a sequence f(x) = n
x mod a (x is an integer => 0, a and n are integers => 1, a => n), f(x) is periodic if a and n are coprime for all a and n? And on top of that, the period of f(x) under those conditions seems to be at most equal to a. Are my suspicions true, and if so, how would you go about proving it? If they are false, give counterexamples.
(This feels like one of those problems that would be blindingly obvious with some knowledge of modular arithmetic, which I don't have.)