cp's OEIS Frontend

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.

A320170 Every pair of consecutive numbers sums to a palindrome, starting with a(0)=1; a(1)=10, and taking a(n) = smallest number > a(n-2).

This page as a plain text file.
%I A320170 #24 Apr 27 2020 02:33:41
%S A320170 1,10,12,21,23,32,34,43,45,54,47,64,57,74,67,84,77,94,87,104,98,114,
%T A320170 108,124,118,134,128,144,138,154,149,164,159,174,169,184,179,194,189,
%U A320170 204,200,214,210,224,220,234,230,244,240,254,251,264,261,274,271
%N A320170 Every pair of consecutive numbers sums to a palindrome, starting with a(0)=1; a(1)=10, and taking a(n) = smallest number > a(n-2).
%t A320170 Nest[Append[#, Block[{k = #[[-2]] + 1}, While[! PalindromeQ[#[[-1]] + k], k++]; k]] &, {1, 10}, 53] (* _Michael De Vlieger_, Oct 10 2018 *)
%o A320170 (Python)
%o A320170 CurrentNum=10
%o A320170 PreviousNum=1
%o A320170 NewNum=0
%o A320170 def NextPalindrome(StartNum):
%o A320170     FoundNext=0
%o A320170     t=0
%o A320170     n=0
%o A320170     Number=0
%o A320170     Lastdigit=0
%o A320170     while FoundNext<=PreviousNum:
%o A320170         n=n+1
%o A320170         t=StartNum+n
%o A320170         Number=t
%o A320170         Reverse=0
%o A320170         while Number>0:
%o A320170             Lastdigit=Number%10
%o A320170             Reverse=(Reverse*10)+Lastdigit
%o A320170             Number=Number//10
%o A320170         if t==Reverse:
%o A320170             FoundNext=n
%o A320170     return n
%o A320170 print(1)
%o A320170 print(10)
%o A320170 for x in range(50):
%o A320170     NewNum=NextPalindrome(CurrentNum)
%o A320170     print(NewNum)
%o A320170     PreviousNum=CurrentNum
%o A320170     CurrentNum=NewNum
%Y A320170 Cf. A062932.
%Y A320170 For n < 10, equals A061870 and A175885.
%K A320170 nonn,easy,base
%O A320170 0,2
%A A320170 _Jim Singh_, Oct 07 2018