login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A259385 Palindromic numbers in bases 2 and 9 written in base 10. 16
0, 1, 3, 5, 7, 127, 255, 273, 455, 6643, 17057, 19433, 19929, 42405, 1245161, 1405397, 1786971, 2122113, 3519339, 4210945, 67472641, 90352181, 133638015, 134978817, 271114881, 6080408749, 11022828069, 24523959661, 25636651261, 25726334461, 28829406059, 1030890430479, 1032991588623, 1085079274815, 1616662113341 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
FORMULA
Intersection of A006995 and A029955.
EXAMPLE
273 is in the sequence because 273_10 = 333_9 = 100010001_2.
MATHEMATICA
(* first load nthPalindromeBase from A002113 *) palQ[n_Integer, base_Integer] := Block[{}, Reverse[ idn = IntegerDigits[n, base]] == idn]; k = 0; lst = {}; While[k < 21000000, pp = nthPalindromeBase[k, 9]; If[palQ[pp, 2], AppendTo[lst, pp]; Print[pp]]; k++]; lst
PROG
(Python)
def nextpal(n, base): # m is the first palindrome successor of n in base base
m, pl = n+1, 0
while m > 0:
m, pl = m//base, pl+1
if n+1 == base**pl:
pl = pl+1
n = n//(base**(pl//2))+1
m, n = n, n//(base**(pl%2))
while n > 0:
m, n = m*base+n%base, n//base
return m
n, a2, a9 = 0, 0, 0
while n <= 30:
if a2 < a9:
a2 = nextpal(a2, 2)
elif a9 < a2:
a9 = nextpal(a9, 9)
else: # a2 == a9
print(a2, end=", ")
a2, a9, n = nextpal(a2, 2), nextpal(a9, 9), n+1 # A.H.M. Smeets, Jun 03 2019
CROSSREFS
Sequence in context: A046201 A292848 A128344 * A114366 A088092 A174271
KEYWORD
nonn,base
AUTHOR
Eric A. Schmidt and Robert G. Wilson v, Jul 16 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 19:06 EDT 2024. Contains 371962 sequences. (Running on oeis4.)