OFFSET
1,1
COMMENTS
This sequence is not periodic.
REFERENCES
Ilan Vardi, "Computational Recreations in Mathematica," Addison-Wesley Publishing, Redwood City, CA, 1991, p. 226-229.
LINKS
Robert P. Munafo, Hypercalc - The Calculator That Doesn't Overflow.
Robert G. Wilson v, Mathematica coding for "SuperPowerMod" from Vardi.
Wolfram cloud Function Repository, PowerTowerMod.
EXAMPLE
a(2) = 3^2 (mod 10) = 9.
a(3) = 5^3 (mod 10) = 5.
MATHEMATICA
a[n_] := Switch[ Mod[ Prime[n], 10], 1, 1, 3, If[ Mod[ Prime[n -1], 4] == 1, 3, 7], 5, 5, 7, If[ Mod[ Prime[n -1], 4] == 1, 7, 3], 9, 9]; a[1] = 2; a[2] = 9; Array[a, 105]
PROG
(PARI) a(n) = if(n<2, 2, lift(Mod(prime(n), 10)^prime(n-1))) \\ Hugo Pfoertner, Jul 07 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Jun 06 2024
STATUS
approved