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 A023109 #56 Feb 16 2025 08:32:34 %S A023109 0,10,19,59,69,166,79,188,193,1397,829,167,2069,1797,849,177,1496,739, %T A023109 1798,10777,6999,1297,869,187,89,10797,10853,10921,10971,13297,10548, %U A023109 13293,17793,20889,700269,106977,108933,80359,13697,10794,15891,1009227,1007619,1009246,1008628,600259,131996,70759,1007377,1001699,600279,141996,70269,10677,10833,10911 %N A023109 a(0) = 0. For n > 0, smallest non-palindromic number k such that the smallest palindrome in the Reverse and Add! trajectory of k is reached after exactly n iterations. %C A023109 From _Felix Fröhlich_, May 28 2022: (Start) %C A023109 Variant of A015994 not allowing palindromes as starting values. %C A023109 Smallest non-palindromic k such that A033665(k) = n. (End) %H A023109 Chai Wah Wu, <a href="/A023109/b023109.txt">Table of n, a(n) for n = 0..100</a> %H A023109 Jason Doucette, <a href="http://www.jasondoucette.com/worldrecords.html#Most">World Records</a> %H A023109 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/196-Algorithm.html">196-Algorithm.</a> %H A023109 <a href="/index/Res#RAA">Index entries for sequences related to Reverse and Add!</a> %t A023109 Table[ SelectFirst[Range[0, 20000], (np = #; i = 0; %t A023109 While[ ! PalindromeQ[np] && i <= n, np = np + IntegerReverse[np]; %t A023109 i++]; i == n ) &] , {n, 0, 32}] (* _Robert Price_, Oct 16 2019 *) %o A023109 (PARI) %o A023109 rev(n)={d=digits(n);p="";for(i=1,#d,p=concat(Str(d[i]),p));return(eval(p))} %o A023109 nbs(n)=if(n==rev(n),return(0));for(k=1,10^3,i=n+rev(n);if(rev(i)==i,return(k));n=i) \\ A033665 %o A023109 a(n)=for(k=1,10^8,if(nbs(k)==n,return(k))) %o A023109 n=0;while(n<100,print1(a(n),", ");n++) \\ _Derek Orr_, Jul 28 2014 %o A023109 (Python) %o A023109 def A023109(n): %o A023109 if n > 0: %o A023109 k = 0 %o A023109 while True: %o A023109 m = k %o A023109 for i in range(n): %o A023109 if str(m) == str(m)[::-1]: %o A023109 break %o A023109 m += int(str(m)[::-1]) %o A023109 else: %o A023109 if str(m) == str(m)[::-1]: %o A023109 return k %o A023109 k += 1 %o A023109 else: %o A023109 return 0 %o A023109 # _Chai Wah Wu_, Feb 08 2015 %o A023109 (PARI) revadd(n) = n+eval(concat(Vecrev(Str(n)))) %o A023109 iterationstosmallestpalindrome(n, bound) = my(x=n, i=0, d); while(1, if(i > bound, return(-1)); x=revadd(x); i++; d=digits(x); if(d==Vecrev(d), return(i))) %o A023109 a(n) = if(n==0, return(0)); for(k=1, oo, my(d=digits(k)); if(d!=Vecrev(d), if(iterationstosmallestpalindrome(k, n)==n, return(k)))) \\ _Felix Fröhlich_, May 28 2022 %Y A023109 Cf. A015994, A033665, A006960. %K A023109 nonn,base,nice %O A023109 0,2 %A A023109 _David W. Wilson_ %E A023109 a(41)-a(55) verified and added by _Aldo González Lorenzo_, May 15 2011 %E A023109 Name edited by _Felix Fröhlich_, May 28 2022