A066799 Square array read by antidiagonals of eventual period of powers of k mod n; period of repeating digits of 1/n in base k.
1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1, 1, 2, 1, 4, 2, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 2, 2, 1, 2, 3, 2, 6, 1, 1, 1, 1, 1, 4, 1, 6, 1, 1, 4, 1, 1, 1, 1, 1, 4, 1, 2, 2, 3, 4, 10, 1, 1, 1, 2, 1, 2, 2, 1, 1, 6, 2, 5, 2, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 5, 2, 12
Offset: 1
Examples
Rows start: 1,1,1,1,1,...; 1,1,1,1,1,...; 1,2,1,1,2,...; 1,1,2,1,1; 1,4,4,2,1,... T(3,2)=2 since the powers of 2 become 1,2,1,2,1,2,... mod 3 with period 2. T(4,2)=1 since the powers of 2 become 1,2,0,0,0,0,... mod 4 with eventual period 1. Beginning of array: +-----+-------------------------------------------------------------------- | n\k | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... +-----+-------------------------------------------------------------------- | 1 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... | 2 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... | 3 | 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, ... | 4 | 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, ... | 5 | 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, ... | 6 | 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, ... | 7 | 1, 3, 6, 3, 6, 2, 1, 1, 3, 6, 3, 6, 2, 1, 1, 3, ... | 8 | 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, ... | ... |
Links
Crossrefs
Programs
-
Mathematica
t[n_, k_] := For[p = PowerMod[k, n, n]; m = n + 1, True, m++, If[PowerMod[k, m, n] == p, Return[m - n]]]; Flatten[Table[t[n - k + 1, k], {n, 1, 14}, {k, n, 1, -1}]] (* Jean-François Alcover, Jun 04 2012 *)
-
PARI
a(n, k) = my(p=k^n%n); for(m=n+1, +oo, if(k^m%n==p, return(m-n))) \\ Iain Fox, Mar 12 2018
Formula
T(n, k) = T(n, k-n) if k > n.
T(n, n) = T(n, n+1) = 1.
T(n, n-1) = 2.
Comments