cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A319584 Numbers that are palindromic in bases 2, 4, and 8.

This page as a plain text file.
%I A319584 #52 Jan 27 2024 17:19:05
%S A319584 0,1,3,5,63,65,195,325,341,4095,4097,4161,12291,12483,20485,20805,
%T A319584 21525,21845,258111,262143,262145,266305,786435,798915,1310725,
%U A319584 1311749,1331525,1332549,1376277,1377301,1397077,1398101,16515135,16777215,16777217,16781313
%N A319584 Numbers that are palindromic in bases 2, 4, and 8.
%C A319584 Intersection of A006995, A014192, and A029803.
%C A319584 From _A.H.M. Smeets_, Jun 08 2019: (Start)
%C A319584 Intersection of A006995 and A259382.
%C A319584 Intersection of A014192 and A259380.
%C A319584 Intersection of A029803 and A097856.
%C A319584 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.
%C A319584 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.
%C A319584 All terms A000051(6*k) for k > 0 are included in this sequence.
%C A319584 All terms A052539(3*k) for k > 0 are included in this sequence.
%C A319584 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.
%C A319584 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.
%C A319584 (End)
%H A319584 A.H.M. Smeets, <a href="/A319584/b319584.txt">Table of n, a(n) for n = 1..2298</a>
%H A319584 A.H.M. Smeets, <a href="/A319584/a319584.gif">Scatterplot of log_b(a(n)-a(n-1)) versus log_b(n)</a>
%H A319584 A.H.M. Smeets, <a href="/A319584/a319584_1.gif">Scatterplot of log_b(1-a(n-1)/a(n)) versus log_b(n)</a>
%e A319584 89478485 = 101010101010101010101010101_2 = 11111111111111_4 = 525252525_8.
%t A319584 palQ[n_, b_] := PalindromeQ[IntegerDigits[n, b]];
%t A319584 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 *)
%t A319584 Select[Range[0,168*10^5],AllTrue[Table[IntegerDigits[#,d],{d,{2,4,8}}],PalindromeQ]&] (* _Harvey P. Dale_, Jan 27 2024 *)
%o A319584 (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()]
%o A319584 (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
%o A319584 (Python)
%o A319584 def nextpal(n, base): # m is the first palindrome successor of n in base base
%o A319584     m, pl = n+1, 0
%o A319584     while m > 0:
%o A319584         m, pl = m//base, pl+1
%o A319584     if n+1 == base**pl:
%o A319584         pl = pl+1
%o A319584     n = n//(base**(pl//2))+1
%o A319584     m, n = n, n//(base**(pl%2))
%o A319584     while n > 0:
%o A319584         m, n = m*base+n%base, n//base
%o A319584     return m
%o A319584 def rev(n, b):
%o A319584     m = 0
%o A319584     while n > 0:
%o A319584         n, m = n//b, m*b+n%b
%o A319584     return m
%o A319584 n, a = 1, 0
%o A319584 while n <= 100:
%o A319584     if a == rev(a, 4) == rev(a, 2):
%o A319584         print(a)
%o A319584         n += 1
%o A319584     a = nextpal(a, 8) # _A.H.M. Smeets_, Jun 08 2019
%o A319584 (PARI) ispal(n, b) = my(d=digits(n, b)); Vecrev(d) == d;
%o A319584 isok(n) = ispal(n, 2) && ispal(n, 4) && ispal(n, 8); \\ _Michel Marcus_, Jun 11 2019
%Y A319584 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).
%Y A319584 Cf. A000051, A000225, A002450, A052539.
%K A319584 nonn,base
%O A319584 1,3
%A A319584 _Jeremias M. Gomes_, Sep 23 2018