login
A332054
Tower of 9's modulo n.
2
0, 1, 0, 1, 4, 3, 1, 1, 0, 9, 5, 9, 1, 1, 9, 9, 9, 9, 1, 9, 15, 5, 8, 9, 14, 1, 0, 1, 9, 9, 4, 9, 27, 9, 29, 9, 1, 1, 27, 9, 9, 15, 11, 5, 9, 31, 32, 9, 15, 39, 9, 1, 9, 27, 49, 1, 39, 9, 57, 9, 34, 35, 36, 9, 14, 27, 22, 9, 54, 29, 12, 9, 72, 1, 39, 1, 71, 27
OFFSET
1,5
COMMENTS
a(n) = (9^(9^(9^(9^ ... )))) mod n, provided sufficient 9's are in the tower such that adding more doesn't affect the value of a(n).
FORMULA
a(n) = 9^a(A000010(n)) mod n.
a(n) = (9^^k) mod n, if n < A246497(k), where ^^ is Knuth's double-arrow notation.
PROG
(PARI) a(n) = {my(b, c=0, d=n, k=1, x=1); while(k==1, z=x; y=1; b=1; while(z>0, while(y<z, d=eulerphi(d); y++); b=9^b-floor((9^b-1)/d)*d; z=z-1; y=1; d=n); if(c==b, k=0); c=b; x++); b%n; }
KEYWORD
nonn
AUTHOR
Jinyuan Wang, Mar 03 2020
STATUS
approved