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 A344214 #47 Jun 12 2021 09:19:53 %S A344214 5,11,15,18,19,20,24,27,28,33,36,37,39,42,45,46,48,51,54,55,57,60,63, %T A344214 64,66,69,72,73,75,78,81,82,84,87,90,91,93,96,99,101,105,108,109,110, %U A344214 114,117,118,123,126,127,129,132,135,136,138,141,144,145,147,150,153,154 %N A344214 Numbers k such that repeated iterations of f(m) = (digsum(f(m-1)))^2 + 1 starting from f(1) = k will eventually yield 5 before any other single-digit number. %C A344214 f(x) = digsum(x)^2 + 1 < x for x >= 400, and all iterations terminate in a single digit or lead to the cycle 65 -> 122 -> 26. - _Michael S. Branicky_, May 14 2021 %e A344214 11 is in the list because (1+1)^2 + 1 = 5. %e A344214 12 is not in the list because repeatedly iterating the function starting with f(1) = 12 will yield 2 before 5. %e A344214 13 is not in the list because it will never yield 5. Specifically, 13 -> 17 -> 65 -> 122 -> 26 -> 65 -> ... . %t A344214 Select[Range@100,Last@NestWhileList[Total[IntegerDigits@#]^2+1&,#,#>10&&#!=26&]==5&] (* _Giorgos Kalogeropoulos_, May 12 2021 *) %o A344214 (Python) %o A344214 def f(n): %o A344214 s = 0 %o A344214 while n > 0: %o A344214 s, n = s+n%10, n//10 %o A344214 return s*s+1 %o A344214 n, pota = 0, 0 %o A344214 while n < 62: %o A344214 a, repf, i, ii = pota, 0, 0, 4 %o A344214 while a > 9 and a != repf: %o A344214 a, i = f(a), i+1 %o A344214 if i == ii: %o A344214 repf, ii = a, 2*ii %o A344214 if a == 5: %o A344214 n = n+1 %o A344214 print(pota, end = ", ") %o A344214 pota = pota+1 # _A.H.M. Smeets_, May 13 2021 %o A344214 (Python) %o A344214 def f(x): return sum(map(int, str(x)))**2 + 1 %o A344214 def ok(n): %o A344214 iter = n # set to f(n) if number of iterations must be >= 1 %o A344214 while iter > 9: %o A344214 if iter in {65, 122, 26}: return False %o A344214 iter = f(iter) %o A344214 return iter == 5 %o A344214 print(list(filter(ok, range(1, 155)))) # _Michael S. Branicky_, May 19 2021 %Y A344214 Subsequence of A344208. %Y A344214 Cf. A007953, A052216, A052224, A344208, A118881. %K A344214 nonn,base %O A344214 1,1 %A A344214 _Joseph Brown_, May 11 2021