login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A338917 a(n) = sum_of_digits(a(n-1)^a(n-2)) where a(1)=1 and a(2)=2. 1

%I #21 Nov 19 2020 18:36:14

%S 1,2,2,4,7,7,25,34,151,331,1690,3265,26449,64528,574513,1671208,

%T 16090657,54199564,559922497,2133503863,23506132363

%N a(n) = sum_of_digits(a(n-1)^a(n-2)) where a(1)=1 and a(2)=2.

%H GeeksforGeeks, <a href="https://www.geeksforgeeks.org/sum-digits-given-number-given-power">Sum of digits of a given number to a given power</a>

%F a(n) == 7 (mod 9) for n >= 5. - _Hugo Pfoertner_, Nov 15 2020

%e for n=6, a(6) = sum_of_digits(7^7) = sum_of_digits(823543) = 25

%t a[1]:=1; a[2]:=2; a[n_]:=Total[IntegerDigits[a[n-1]^a[n-2]]]; Array[a,19] (* _Stefano Spezia_, Nov 15 2020 *)

%o (SageMath)

%o a,b=1,2

%o L=[a,b]

%o for n in [1..17]:

%o c=b^a

%o c=sum(c.digits())

%o L.append(c)

%o a,b=b,c

%o print(L)

%o (PARI) a338917(nmax)={my(x=vector(nmax));x[1]=1;x[2]=2;for(k=3,nmax,x[k]=sumdigits(x[k-1]^x[k-2]));x};

%o a338917(18) \\ _Hugo Pfoertner_, Nov 15 2020

%Y Cf. A007953.

%K nonn,base,more

%O 1,2

%A _Sean Lestrange_, Nov 15 2020

%E a(20) from _Hugo Pfoertner_, Nov 15 2020

%E a(21) from _Chai Wah Wu_, Nov 19 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 12 09:23 EDT 2024. Contains 375850 sequences. (Running on oeis4.)