OFFSET
1,4
COMMENTS
a(n) = (7^(7^(7^(7^(7^ ... ))))) mod n, provided sufficient 7's 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
FORMULA
a(n) = 7^a(A000010(n)) mod n. For n <= 10, a(n) = (7^7) mod n.
EXAMPLE
a(2) = 1, as 7^X is odd for any whole number X.
a(11) = 2, as 7^(7^7) == 7^(7^(7^7)) == 7^(7^(7^(7^7))) == 2 (mod 11).
MAPLE
A:= proc(n) option remember; 7 &^ A(numtheory:-phi(n)) mod n end proc:
A(2):= 1;
seq(A(n), n=2..100);
MATHEMATICA
a[n_] := a[n] = Switch[n, 1, 0, 2, 1, _, 7^a[EulerPhi[n]]]~Mod~n;
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Sep 21 2022 *)
PROG
(Sage)
def a(n):
if ( n <= 10 ):
return 823543%n
else:
return power_mod(7, a(euler_phi(n)), n)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wayne VanWeerthuizen, Aug 08 2014
STATUS
approved