login
A245974
Tower of 7's mod n.
9
0, 1, 1, 3, 3, 1, 0, 7, 7, 3, 2, 7, 6, 7, 13, 7, 12, 7, 7, 3, 7, 13, 20, 7, 18, 19, 16, 7, 1, 13, 19, 23, 13, 29, 28, 7, 34, 7, 19, 23, 26, 7, 7, 35, 43, 43, 37, 7, 0, 43, 46, 19, 11, 43, 13, 7, 7, 1, 7, 43, 6, 19, 7, 55, 58, 13, 63, 63, 43, 63, 66, 7, 30
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
STATUS
approved