OFFSET
1,6
COMMENTS
a(n) = (4^(4^(4^(4^(4^ ... ))))) mod n, provided sufficient 4s are in the tower such that adding more doesn't affect the value of a(n).
LINKS
Wayne VanWeerthuizen, Table of n, a(n) for n = 1..10000
PROG
(Sage)
def tower4mod(n):
if n <= 10:
return 256%n
else:
ep = euler_phi(n)
return power_mod(4, ep+tower4mod(ep), n)
[tower4mod(n) for n in range(1, 30)]
(Haskell)
import Math.NumberTheory.Moduli (powerMod)
a245971 n = powerMod 4 (phi + a245971 phi) n
where phi = a000010 n
-- Reinhard Zumkeller, Feb 01 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wayne VanWeerthuizen, Aug 08 2014
STATUS
approved