OFFSET
1,3
COMMENTS
Rajasekaran, Shallit, & Smith prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
Patrick De Geest, Palindromic numbers beyond base 10.
Phakhinkon Phunphayap and Prapanpong Pongsriiam, Estimates for the Reciprocal Sum of b-adic Palindromes, 2019.
Aayush Rajasekaran, Jeffrey Shallit, and Tim Smith, Sums of palindromes: an approach via automata, arXiv:1706.10206 [cs.FL], 2017.
Eric Weisstein's World of Mathematics, Palindromic Number.
Eric Weisstein's World of Mathematics, Ternary.
FORMULA
Sum_{n>=2} 1/a(n) = 2.61676111... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020
MAPLE
isA014190 := proc(n)
local L;
L := convert(n, base, 3) ;
ListTools[Reverse](L) = L ;
end proc:
for n from 0 to 500 do
if isA014190(n) then
printf("%d, ", n) ;
end if;
end do: # R. J. Mathar, Jul 07 2015
MATHEMATICA
f[n_, b_] := Module[{i=IntegerDigits[n, b]}, i==Reverse[i]]; lst={}; Do[If[f[n, 3], AppendTo[lst, n]], {n, 1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
PROG
(Magma) [n: n in [0..800] | Intseq(n, 3) eq Reverse(Intseq(n, 3))]; // Vincenzo Librandi, Sep 09 2015
(Sage)
[n for n in (0..757) if Word(n.digits(3)).is_palindrome()] # Peter Luschny, Sep 13 2018
(PARI) ispal(n, b=3)=my(d=digits(n, b)); d==Vecrev(d) \\ Charles R Greathouse IV, May 03 2020
(Python)
from gmpy2 import digits
def A014190(n):
if n == 1: return 0
y = 3*(x:=3**(len(digits(n>>1, 3))-1))
return int((c:=n-x)*x+int(digits(c, 3)[-2::-1]or'0', 3) if n<x+y else (c:=n-y)*y+int(digits(c, 3)[-1::-1]or'0', 3)) # Chai Wah Wu, Jun 13 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved