login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A319584
Numbers that are palindromic in bases 2, 4, and 8.
2
0, 1, 3, 5, 63, 65, 195, 325, 341, 4095, 4097, 4161, 12291, 12483, 20485, 20805, 21525, 21845, 258111, 262143, 262145, 266305, 786435, 798915, 1310725, 1311749, 1331525, 1332549, 1376277, 1377301, 1397077, 1398101, 16515135, 16777215, 16777217, 16781313
OFFSET
1,3
COMMENTS
Intersection of A006995, A014192, and A029803.
From A.H.M. Smeets, Jun 08 2019: (Start)
Intersection of A006995 and A259382.
Intersection of A014192 and A259380.
Intersection of A029803 and A097856.
All repunit numbers in base 2 with 6*k digits are included in this sequence, i.e., all terms A000225(6*k) for k >= 0.
All repunit numbers in base 4 with 2+3*k digits are included in this sequence, i.e., all terms A002450(2+3*k) for k >= 0.
All terms A000051(6*k) for k > 0 are included in this sequence.
All terms A052539(3*k) for k > 0 are included in this sequence.
In general, for sequences with palindromic numbers in the set of bases {b, b^2, ..., b^k}, gaps of size 2 occur at the term pairs (b^(k!) - 1, b^(k!) + 1). See also A319598 for b = 2 and k = 4.
The terms occur in bursts with large gaps in between as shown in the scatterplots of log_b(a(n)-a(n-1)) versus log_b(n) and log_b(1-a(n-1)/a(n)) versus log_b(n). Terms of this sequence are those with b = 2 and k = 3. For comparison, terms with b = 3 and k = 3 are also shown in these plots.
(End)
EXAMPLE
89478485 = 101010101010101010101010101_2 = 11111111111111_4 = 525252525_8.
MATHEMATICA
palQ[n_, b_] := PalindromeQ[IntegerDigits[n, b]];
Reap[Do[If[palQ[n, 2] && palQ[n, 4] && palQ[n, 8], Print[n]; Sow[n]], {n, 0, 10^6}]][[2, 1]] (* Jean-François Alcover, Sep 25 2018 *)
Select[Range[0, 168*10^5], AllTrue[Table[IntegerDigits[#, d], {d, {2, 4, 8}}], PalindromeQ]&] (* Harvey P. Dale, Jan 27 2024 *)
PROG
(Sage) [n for n in (0..1000) if Word(n.digits(2)).is_palindrome() and Word(n.digits(4)).is_palindrome() and Word(n.digits(8)).is_palindrome()]
(Magma) [n: n in [0..2*10^7] | Intseq(n, 2) eq Reverse(Intseq(n, 2)) and Intseq(n, 4) eq Reverse(Intseq(n, 4)) and Intseq(n, 8) eq Reverse(Intseq(n, 8))]; // Vincenzo Librandi, Sep 24 2018
(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
def rev(n, b):
m = 0
while n > 0:
n, m = n//b, m*b+n%b
return m
n, a = 1, 0
while n <= 100:
if a == rev(a, 4) == rev(a, 2):
print(a)
n += 1
a = nextpal(a, 8) # A.H.M. Smeets, Jun 08 2019
(PARI) ispal(n, b) = my(d=digits(n, b)); Vecrev(d) == d;
isok(n) = ispal(n, 2) && ispal(n, 4) && ispal(n, 8); \\ Michel Marcus, Jun 11 2019
CROSSREFS
Cf. A006995 (base 2), A014192 (base 4), A029803 (base 8), A097956 (bases 2 and 4), A259380 (bases 2 and 8), A259382 (bases 4 and 8), A319598 (bases 2, 4, 8 and 16).
Sequence in context: A273254 A222644 A181904 * A318546 A076513 A222611
KEYWORD
nonn,base
AUTHOR
Jeremias M. Gomes, Sep 23 2018
STATUS
approved