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!)
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. 35
0, 10, 19, 59, 69, 166, 79, 188, 193, 1397, 829, 167, 2069, 1797, 849, 177, 1496, 739, 1798, 10777, 6999, 1297, 869, 187, 89, 10797, 10853, 10921, 10971, 13297, 10548, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
From Felix Fröhlich, May 28 2022: (Start)
Variant of A015994 not allowing palindromes as starting values.
Smallest non-palindromic k such that A033665(k) = n. (End)
LINKS
Jason Doucette, World Records
Eric Weisstein's World of Mathematics, 196-Algorithm.
MATHEMATICA
Table[ SelectFirst[Range[0, 20000], (np = #; i = 0;
While[ ! PalindromeQ[np] && i <= n, np = np + IntegerReverse[np];
i++]; i == n ) &] , {n, 0, 32}] (* Robert Price, Oct 16 2019 *)
PROG
(PARI)
rev(n)={d=digits(n); p=""; for(i=1, #d, p=concat(Str(d[i]), p)); return(eval(p))}
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
a(n)=for(k=1, 10^8, if(nbs(k)==n, return(k)))
n=0; while(n<100, print1(a(n), ", "); n++) \\ Derek Orr, Jul 28 2014
(Python)
def A023109(n):
if n > 0:
k = 0
while True:
m = k
for i in range(n):
if str(m) == str(m)[::-1]:
break
m += int(str(m)[::-1])
else:
if str(m) == str(m)[::-1]:
return k
k += 1
else:
return 0
# Chai Wah Wu, Feb 08 2015
(PARI) revadd(n) = n+eval(concat(Vecrev(Str(n))))
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)))
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
CROSSREFS
Sequence in context: A369305 A065198 A033866 * A255530 A146091 A007811
KEYWORD
nonn,base,nice
AUTHOR
EXTENSIONS
a(41)-a(55) verified and added by Aldo González Lorenzo, May 15 2011
Name edited by Felix Fröhlich, May 28 2022
STATUS
approved

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 April 19 05:19 EDT 2024. Contains 371782 sequences. (Running on oeis4.)