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
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; }
CROSSREFS
KEYWORD
nonn
AUTHOR
Jinyuan Wang, Mar 03 2020
STATUS
approved