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.

A046497 Palindromes expressible as sum of 2 consecutive palindromes.

This page as a plain text file.
%I A046497 #24 Aug 11 2024 14:41:31
%S A046497 1,3,5,7,9,11,33,55,77,99,121,212,232,252,272,292,393,414,434,454,474,
%T A046497 494,595,616,636,656,676,696,797,818,838,858,878,898,999,2112,2332,
%U A046497 2552,2772,2992,3993,4114,4334,4554,4774,4994,5995,6116,6336,6556,6776,6996,7997,8118,8338,8558
%N A046497 Palindromes expressible as sum of 2 consecutive palindromes.
%C A046497 Contains all palindromes such that the middle digit is odd (if number of digits is odd) or middle two digits are odd (if number of digits is even) and all other digits are even; also palindromes where the first and last digits are odd (but not 1) and all other digits are 9. - _Robert Israel_, Nov 12 2018
%H A046497 Robert Israel, <a href="/A046497/b046497.txt">Table of n, a(n) for n = 1..10000</a>
%H A046497 P. De Geest, <a href="https://www.worldofnumbers.com/index.html">World!Of Numbers</a>
%e A046497 999 = 494 + 505.
%p A046497 ispali:= proc(n) local L;
%p A046497 L:= convert(n, base, 10);
%p A046497 L = ListTools:-Reverse(L)
%p A046497 end proc:
%p A046497 digrev:= proc(n) local L;
%p A046497   L:= convert(n, base, 10);
%p A046497   add(L[-i]*10^(i-1), i=1..nops(L))
%p A046497 end proc:
%p A046497 N:=5; Pals:= $0..9:
%p A046497 for d from 2 to N do
%p A046497   q:= p;
%p A046497   if d::even then
%p A046497     m:= d/2;
%p A046497     Pals:= Pals, seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1);
%p A046497   else
%p A046497     m:= (d-1)/2;
%p A046497     Pals:= Pals, seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1);
%p A046497   fi
%p A046497 od:
%p A046497 Pals:= [Pals]:
%p A046497 select(ispali, Pals[1..-2]+Pals[2..-1]); # _Robert Israel_, Nov 12 2018
%t A046497 palQ[n_] := Reverse[x = IntegerDigits[n]] == x; Select[Total /@ Partition[Select[Range[3500], palQ], 2, 1], palQ] (* _Jayanta Basu_, Jun 26 2013 *)
%t A046497 nextPalindrome[n_]:=Module[{k=n+1},While[!PalindromeQ[k],k++]; k]; s={}; Do[If[PalindromeQ[n], sum =n +  nextPalindrome[n]; If[PalindromeQ[sum],AppendTo[s, sum]]],{n,0,10000}]; s (* _Amiram Eldar_, Nov 10 2018 *)
%t A046497 Select[Total/@Partition[Select[Range[0,5000],PalindromeQ],2,1],PalindromeQ] (* _Harvey P. Dale_, Sep 24 2021 *)
%Y A046497 Cf. A002113.
%K A046497 nonn,base
%O A046497 1,2
%A A046497 _Patrick De Geest_, Sep 15 1998
%E A046497 a(1)=1 inserted by _Alois P. Heinz_, Nov 13 2018