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!)
A062932 a(0) = 0; a(n) = smallest number > a(n-1) such that a(n-1)+a(n) is a palindrome. 5

%I #26 Nov 09 2015 05:27:52

%S 0,1,2,3,4,5,6,16,17,27,28,38,39,49,50,51,60,61,70,71,80,81,90,91,100,

%T 102,110,112,120,122,130,132,140,142,150,153,160,163,170,173,180,183,

%U 190,193,200,204,210,214,220,224,230,234,240,244,250,255,260,265,270

%N a(0) = 0; a(n) = smallest number > a(n-1) such that a(n-1)+a(n) is a palindrome.

%H Harry J. Smith, <a href="/A062932/b062932.txt">Table of n, a(n) for n = 0..1000</a>

%e 17 is a term hence the next term is 27, as 17 + 27 = 44 is a palindrome, but 17 + 18 = 35 through 17 + 26 = 43 are not palindromes.

%t palQ[n_] := Block[{d = IntegerDigits@ n}, Reverse@ d == d]; a = {1}; Do[k = a[[n - 1]] + 1; While[! palQ[a[[n - 1]] + k], k++]; AppendTo[a, k], {n, 2, 58}]; {0}~Join~a (* _Michael De Vlieger_, Oct 05 2015 *)

%o (PARI) digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) }

%o Palin(x)= { local(y,d,e,f); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) }

%o { for (n=1, 1000, if (n>1, while (!Palin(a1 + a++),); a1=a, a=a1=1); write("b062932.txt", n, " ", a) ) } \\ _Harry J. Smith_, Aug 13 2009

%Y Cf. A228730 (non-monotonic variant).

%K nonn,base,easy

%O 0,3

%A _Amarnath Murthy_, Jul 05 2001

%E Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jul 02 2001

%E Initial a(0)=0 prefixed by _M. F. Hasler_, Nov 09 2013

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 24 09:18 EDT 2024. Contains 371935 sequences. (Running on oeis4.)