login
A029954
Palindromic in base 7.
30
0, 1, 2, 3, 4, 5, 6, 8, 16, 24, 32, 40, 48, 50, 57, 64, 71, 78, 85, 92, 100, 107, 114, 121, 128, 135, 142, 150, 157, 164, 171, 178, 185, 192, 200, 207, 214, 221, 228, 235, 242, 250, 257, 264, 271, 278, 285, 292, 300, 307, 314, 321, 328, 335, 342, 344, 400, 456
OFFSET
1,3
COMMENTS
Cilleruelo, Luca, & Baxter prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020
LINKS
Javier Cilleruelo, Florian Luca and Lewis Baxter, Every positive integer is a sum of three palindromes, Mathematics of Computation, Vol. 87, No. 314 (2018), pp. 3023-3055, arXiv preprint, arXiv:1602.06208 [math.NT], 2017.
Phakhinkon Phunphayap and Prapanpong Pongsriiam, Estimates for the Reciprocal Sum of b-adic Palindromes, 2019.
FORMULA
Sum_{n>=2} 1/a(n) = 3.1313768... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020
MATHEMATICA
f[n_, b_] := Module[{i=IntegerDigits[n, b]}, i==Reverse[i]]; lst={}; Do[If[f[n, 7], AppendTo[lst, n]], {n, 1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
pal7Q[n_]:=Module[{idn7=IntegerDigits[n, 7]}, idn7==Reverse[idn7]]; Select[ Range[0, 500], pal7Q] (* Harvey P. Dale, Jul 30 2015 *)
PROG
(Python)
from gmpy2 import digits
def palQgen(l, b): # generator of palindromes in base b of length <= 2*l
if l > 0:
yield 0
for x in range(1, l+1):
for y in range(b**(x-1), b**x):
s = digits(y, b)
yield int(s+s[-2::-1], b)
for y in range(b**(x-1), b**x):
s = digits(y, b)
yield int(s+s[::-1], b)
A029954_list = list(palQgen(4, 7)) # Chai Wah Wu, Dec 01 2014
(Python)
from gmpy2 import digits
from sympy import integer_log
def A029954(n):
if n == 1: return 0
y = 7*(x:=7**integer_log(n>>1, 7)[0])
return int((c:=n-x)*x+int(digits(c, 7)[-2::-1]or'0', 7) if n<x+y else (c:=n-y)*y+int(digits(c, 7)[-1::-1]or'0', 7)) # Chai Wah Wu, Jun 14 2024
(PARI) ispal(n, b=7)=my(d=digits(n, b)); d==Vecrev(d) \\ Charles R Greathouse IV, May 03 2020
CROSSREFS
Palindromes in bases 2 through 10: A006995, A014190, A014192, A029952, A029953, A029954, A029803, A029955, A002113.
Sequence in context: A043710 A296703 A297262 * A048318 A037402 A048332
KEYWORD
nonn,base,easy
STATUS
approved