login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Length of period of the sequence (1^1^1^..., 2^2^2^..., 3^3^3^..., 4^4^4^..., ...) modulo n.
2

%I #21 Jun 19 2023 09:12:29

%S 1,2,6,4,20,6,42,8,18,20,220,12,156,42,60,16,272,18,342,20,42,220,

%T 5060,24,100,156,54,84,2436,60,1860,32,660,272,420,36,1332,342,156,40,

%U 1640,42,1806,220,180,5060,237820,48,294,100,816,156,8268,54,220,168

%N Length of period of the sequence (1^1^1^..., 2^2^2^..., 3^3^3^..., 4^4^4^..., ...) modulo n.

%C For any positive integers a and m the sequence a, a^a, a^a^a, a^a^a^a,... becomes eventually constant modulo m. So the remainder of a^a^a^... modulo n is well-defined.

%C Shapiro and Shapiro treat this problem. - _T. D. Noe_, Jan 30 2009

%H Alois P. Heinz, <a href="/A127699/b127699.txt">Table of n, a(n) for n = 1..20000</a> (first 1000 terms from T. D. Noe)

%H Daniel B. Shapiro and S. David Shapiro, <a href="http://www.emis.de/journals/INTEGERS/papers/h23/h23.Abstract.html">Iterated Exponents in Number Theory,</a> Integers 7 (2007), #A23.

%F a(n) = lcm(n, a(lambda(n))), where lambda is Carmichael's reduced totient function. - _T. D. Noe_, Jan 30 2009

%e a(10)=20 because the last digit of 1^1^1^.. is 1; the sequence 2,2^2,2^2^2,.. ends with 2,4,6,6,...; the sequence 3,3^3,3^3^3,... with 3,7,7,...; 4,4^4,4^4^4,... with 4,6,6,...; and so on. We get as last digits 1,6,7,6,5,6,3,6,9,0, 1,6,3,6,5,6,7,6,9,0 and then the pattern repeats.

%p a:= proc(n) option remember; `if`(n=1, 1,

%p ilcm(n, a(numtheory[lambda](n))))

%p end:

%p seq(a(n), n=1..56); # _Alois P. Heinz_, Jan 03 2023

%t nn=100; a=Table[0,{nn}]; a[[1]]=1; Do[a[[n]]=LCM[n,a[[CarmichaelLambda[n]]]], {n,2,nn}]; a (* _T. D. Noe_, Jan 30 2009 *)

%o (Python)

%o from functools import lru_cache

%o from math import lcm

%o from sympy import reduced_totient

%o @lru_cache(maxsize=None)

%o def A127699(n): return 1 if n == 1 else lcm(n, A127699(reduced_totient(n))) # _Chai Wah Wu_, Jan 03 2023

%Y Cf. A002322.

%K easy,nonn

%O 1,2

%A _Jan Fricke_, Apr 11 2007

%E Extension and correction from _T. D. Noe_, Jan 30 2009

%E Incorrect formula removed by _T. D. Noe_, Feb 02 2009