This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A061588 #46 May 27 2025 14:53:49 %S A061588 2,4,16,136,1936,181936,164181936,13616164181936, %T A061588 193613613616164181936,1819361936193613613616164181936, %U A061588 1641819361819361819361936193613613616164181936,136161641819361641819361641819361819361819361936193613613616164181936 %N A061588 a(1) = 2; thereafter a(n) is the number obtained by replacing each digit of a(n-1) with its square. %H A061588 John Cerkan, <a href="/A061588/b061588.txt">Table of n, a(n) for n = 1..18</a> %H A061588 William Davidson, <a href="https://web.archive.org/web/20231214050824/https://www.maa.org/sites/default/files/pdf/abstracts/mf2012_abstracts.pdf">Introducing the peculiar 'Davidson Sequence'</a>, MathFest 2012; see p. 37. %F A061588 From _William Davidson_, Aug 15 2012: (Start) %F A061588 For integer n > 5, %F A061588 a(n) = a(n-4)*10^(L(a(n-5))+L(a(n-1))) + a(n-5)*10^(L(a(n-1))) + a(n-1), where L(x) is the number of digits in x. %F A061588 L(a(n)) = (W^(n-1)*[s1]^T)^T*[d]^T, where W is the 5 X 5 square matrix [(0 1 0 0 0) (0 0 1 0 0) (0 0 0 1 0) (0 0 0 0 1) (1 1 0 0 1)], [s1] = [1 2 3 4 6], [d] = [1 0 0 0 0], and T denotes transpose. %F A061588 To determine the initial digits of a(n), n > 5, let b = ((n+2) mod 4) + 2. Then a(n) begins with a(b). E.g. let n = 100, b = 4, then a(100) = 1936... (End) %e A061588 After 136: the squares of 1, 3, 6 are 1, 9, 36 respectively hence the next term is 1936. %e A061588 a(11) = a(7)*10^L(a(6)+a(10))+a(6)*10^L(a(10))+a(10) %e A061588 = 13616164181936*10^55 + 164181936*10^46 + %e A061588 1641819361819361819361936193613613616164181936 %e A061588 = 136161641819361641819361641819361819361819361936193613613616164181936 %e A061588 a(100) = 1936...*10^L(a(96)+a(99))+136...*10^L(a(99))+136...936, where L(100) has approximately 2.74*10^17 digits. - _William Davidson_, Aug 15 2012 %t A061588 NestList[FromDigits[Flatten[IntegerDigits[IntegerDigits[#]^2]]] &, 2, 11] (* _Paolo Xausa_, Jan 10 2025 *) %o A061588 (Python) %o A061588 def digits(n): %o A061588 d = [] %o A061588 while n > 0: %o A061588 d.append(n % 10) %o A061588 n = n // 10 %o A061588 return d %o A061588 def sqdig(n): %o A061588 new = 0 %o A061588 num = digits(n) %o A061588 spacing = 0 %o A061588 while num: %o A061588 k = num.pop(0) %o A061588 new += (10 ** (spacing)) * (k**2) %o A061588 if k > 3: %o A061588 spacing += 1 %o A061588 spacing += 1 %o A061588 return new %o A061588 def a(n): %o A061588 i = 2 %o A061588 while n > 1: %o A061588 i = sqdig(i) %o A061588 n -= 1 %o A061588 return i %o A061588 # _David Nacin_, Aug 19 2012 %o A061588 (Python) %o A061588 from itertools import accumulate %o A061588 def f(an, _): return int("".join(str(int(d)**2) for d in str(an))) %o A061588 print(list(accumulate([2]*11, f))) # _Michael S. Branicky_, Jan 01 2022 %K A061588 nonn,easy,base %O A061588 1,1 %A A061588 _Amarnath Murthy_, May 13 2001 %E A061588 More terms from Larry Reeves (larryr(AT)acm.org) and _Asher Auel_, May 15 2001 %E A061588 Corrected by _Matthew Vandermast_, Apr 23 2003