login
a(1) = 2; thereafter, a(n) = prime(n)^prime(n-1) (mod 10).
0

%I #25 Jul 07 2024 13:34:05

%S 2,9,5,7,1,7,7,9,7,9,1,3,1,3,3,7,9,1,7,1,7,9,7,9,7,1,3,3,9,3,7,1,3,9,

%T 9,1,3,3,3,7,9,1,1,7,7,9,1,7,3,9,3,9,1,1,3,3,9,1,3,1,3,7,7,1,7,7,1,3,

%U 7,9,3,9,3,7,9,7,9,7,1,9,9,1,1,7,9,7,9,7,1,3,3,9,3,1,9,7,9,1,3,1,7,3,3,9,1

%N a(1) = 2; thereafter, a(n) = prime(n)^prime(n-1) (mod 10).

%C This sequence is not periodic.

%D Ilan Vardi, "Computational Recreations in Mathematica," Addison-Wesley Publishing, Redwood City, CA, 1991, p. 226-229.

%H Robert P. Munafo, <a href="https://mrob.com/pub/perl/hypercalc.html">Hypercalc - The Calculator That Doesn't Overflow</a>.

%H Robert P. Munafo, <a href="https://mrob.com/pub/seq/a092188.html">Sequence A092188, Smallest Positive Integer M such that 2^3^4^5^...^N = M mod N</a>.

%H Robert G. Wilson v, <a href="/A133612/a133612_2.txt">Mathematica coding for "SuperPowerMod" from Vardi</a>.

%H Wolfram cloud Function Repository, <a href="https://resources.wolframcloud.com/FunctionRepository/resources/PowerTowerMod">PowerTowerMod</a>.

%e a(2) = 3^2 (mod 10) = 9.

%e a(3) = 5^3 (mod 10) = 5.

%t 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]

%o (PARI) a(n) = if(n<2, 2, lift(Mod(prime(n),10)^prime(n-1))) \\ _Hugo Pfoertner_, Jul 07 2024

%Y Cf. A000040, A092188, A133612, A171881, A171882, A213013, A336111, A342176.

%K nonn

%O 1,1

%A _Robert G. Wilson v_, Jun 06 2024