login
A320602
Irregular table read by rows: T(n,k) = (k+s)^(k+s) mod n, s = lcm(n, A002322(n)) = A174824(n), 0 <= k <= s - 1.
1
0, 0, 1, 0, 1, 1, 0, 1, 2, 0, 1, 0, 3, 0, 1, 4, 2, 1, 0, 1, 3, 1, 4, 0, 1, 1, 3, 1, 0, 1, 2, 4, 4, 0, 1, 4, 3, 4, 5, 0, 1, 4, 6, 4, 3, 1, 0, 1, 1, 4, 2, 1, 6, 0, 1, 2, 5, 1, 5, 1, 0, 1, 4, 1, 4, 4, 6, 0, 1, 1, 3, 2, 6, 1, 0, 1, 2, 2, 1, 2, 6, 0, 1, 0, 3, 0, 5, 0, 7
OFFSET
1,9
COMMENTS
A174824(n) is the period of the sequence {k^k mod n}.
If n > 1 is factored as Product_{i=1..m} (p_i)^(e_i), then {k^k mod n : k > e} is purely periodic, e = max_{i=1..m} (p_i)*floor((e_i - 1)/(p_i)). For n > 1, {k^k mod n : k > 0} is purely periodic iff e_i <= p_i, 1 <= i <= m.
FORMULA
T(n,k) = k^k mod n iff: let p be any prime factor of k, then n is not divisible by p^(k+1).
EXAMPLE
Table starts
n = 1: 0,
n = 2: 0, 1,
n = 3: 0, 1, 1, 0, 1, 2,
n = 4: 0, 1, 0, 3,
n = 5: 0, 1, 4, 2, 1, 0, 1, 3, 1, 4, 0, 1, 1, 3, 1, 0, 1, 2, 4, 4,
n = 6: 0, 1, 4, 3, 4, 5,
n = 7: 0, 1, 4, 6, 4, 3, 1, 0, 1, 1, 4, 2, 1, 6, 0, 1, 2, 5, 1, 5, 1, 0, 1, 4, 1, 4, 4, 6, 0, 1, 1, 3, 2, 6, 1, 0, 1, 2, 2, 1, 2, 6,
n = 8: 0, 1, 0, 3, 0, 5, 0, 7,
n = 9: 0, 1, 4, 0, 4, 2, 0, 7, 1, 0, 1, 5, 0, 4, 7, 0, 7, 8,
n = 10: 0, 1, 4, 7, 6, 5, 6, 3, 6, 9, 0, 1, 6, 3, 6, 5, 6, 7, 4, 9,
PROG
(PARI) T(n, k) = my(s=lcm(n, lcm(znstar(n)[2]))); lift(Mod(k+s, n)^(k+s))
tabf(nn) = for(n=1, nn, for(k=0, lcm(n, lcm(znstar(n)[2])))-1, print1(T(n, k), ", ")); print);
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Jianing Song, Oct 17 2018
STATUS
approved