%I #39 Jun 14 2024 11:08:24
%S 0,1,2,3,5,10,15,17,21,25,29,34,38,42,46,51,55,59,63,65,85,105,125,
%T 130,150,170,190,195,215,235,255,257,273,289,305,325,341,357,373,393,
%U 409,425,441,461,477,493,509,514,530,546,562,582,598,614,630,650,666
%N Palindromes in base 4 (written in base 10).
%C Rajasekaran, Shallit, & Smith prove that this sequence is an additive basis of order (exactly) 3. - _Charles R Greathouse IV_, May 03 2020
%H T. D. Noe, <a href="/A014192/b014192.txt">Table of n, a(n) for n = 1..10000</a>
%H Patrick De Geest, <a href="http://www.worldofnumbers.com/nobase10.htm">Palindromic numbers beyond base 10</a>.
%H Phakhinkon Phunphayap and Prapanpong Pongsriiam, <a href="https://doi.org/10.13140/RG.2.2.23202.79047">Estimates for the Reciprocal Sum of b-adic Palindromes</a>, 2019.
%H Aayush Rajasekaran, Jeffrey Shallit, and Tim Smith, <a href="https://arxiv.org/abs/1706.10206">Sums of palindromes: an approach via automata</a>, arXiv:1706.10206 [cs.FL], 2017.
%H <a href="/index/Ab#basis_03">Index entries for sequences that are an additive basis</a>, order 3.
%F Sum_{n>=2} 1/a(n) = 2.7857715... (Phunphayap and Pongsriiam, 2019). - _Amiram Eldar_, Oct 17 2020
%t f[n_,b_] := Module[{i=IntegerDigits[n,b]}, i==Reverse[i]]; lst={}; Do[If[f[n,4], AppendTo[lst,n]], {n,1000}]; lst (* _Vladimir Joseph Stephan Orlovsky_, Jul 08 2009 *)
%t pal4Q[n_]:=Module[{c=IntegerDigits[n,4]},c==Reverse[c]]; Select[Range[ 0,700],pal4Q] (* _Harvey P. Dale_, Jul 21 2020 *)
%o (Magma) [n: n in [0..800] | Intseq(n, 4) eq Reverse(Intseq(n, 4))]; // _Vincenzo Librandi_, Sep 09 2015
%o (PARI) ispal(n,b=4)=my(d=digits(n,b)); d==Vecrev(d) \\ _Charles R Greathouse IV_, May 03 2020
%o (Python)
%o from gmpy2 import digits
%o def A014192(n):
%o if n == 1: return 0
%o y = (x:=1<<(n.bit_length()-2&-2))<<2
%o return (c:=n-x)*x+int(digits(c,4)[-2::-1]or'0',4) if n<x+y else (c:=n-y)*y+int(digits(c,4)[-1::-1]or'0',4) # _Chai Wah Wu_, Jun 14 2024
%Y Palindromes in bases 2 through 10: A006995, A014190, A014192, A029952, A029953, A029954, A029803, A029955, A002113.
%K nonn,base,easy
%O 1,3
%A _N. J. A. Sloane_
%E More terms from _Patrick De Geest_