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.

A259385 Palindromic numbers in bases 2 and 9 written in base 10.

This page as a plain text file.
%I A259385 #25 May 01 2020 12:17:34
%S A259385 0,1,3,5,7,127,255,273,455,6643,17057,19433,19929,42405,1245161,
%T A259385 1405397,1786971,2122113,3519339,4210945,67472641,90352181,133638015,
%U A259385 134978817,271114881,6080408749,11022828069,24523959661,25636651261,25726334461,28829406059,1030890430479,1032991588623,1085079274815,1616662113341
%N A259385 Palindromic numbers in bases 2 and 9 written in base 10.
%H A259385 Giovanni Resta, <a href="/A259385/b259385.txt">Table of n, a(n) for n = 1..44</a>
%H A259385 A.H.M. Smeets, <a href="/A259385/a259385.gif">Scatterplot of log_2(number is palindromic in base 2 and base b) versus b, for b in {3,5,6,7,9,10}</a>
%H A259385 <a href="/index/Pac#palindromes">Index entries for sequences related to palindromes</a>
%F A259385 Intersection of A006995 and A029955.
%e A259385 273 is in the sequence because 273_10 = 333_9 = 100010001_2.
%t A259385 (* 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
%o A259385 (Python)
%o A259385 def nextpal(n, base): # m is the first palindrome successor of n in base base
%o A259385     m, pl = n+1, 0
%o A259385     while m > 0:
%o A259385         m, pl = m//base, pl+1
%o A259385     if n+1 == base**pl:
%o A259385         pl = pl+1
%o A259385     n = n//(base**(pl//2))+1
%o A259385     m, n = n, n//(base**(pl%2))
%o A259385     while n > 0:
%o A259385         m, n = m*base+n%base, n//base
%o A259385     return m
%o A259385 n, a2, a9 = 0, 0, 0
%o A259385 while n <= 30:
%o A259385     if a2 < a9:
%o A259385         a2 = nextpal(a2,2)
%o A259385     elif a9 < a2:
%o A259385         a9 = nextpal(a9, 9)
%o A259385     else: # a2 == a9
%o A259385         print(a2, end=",")
%o A259385         a2, a9, n = nextpal(a2,2), nextpal(a9,9), n+1 # _A.H.M. Smeets_, Jun 03 2019
%Y A259385 Cf. A048268, A060792, A097856, A097928, A182232, A259374, A097929, A182233, A259375, A259376, A097930, A182234, A259377, A259378, A249156, A097931, A259380, A259381, A259382, A259383, A259384, A099145, A259385, A259386, A259387, A259388, A259389, A259390, A099146, A007632, A007633, A029961, A029962, A029963, A029964, A029804, A029965, A029966, A029967, A029968, A029969, A029970, A029731, A097855, A250408, A250409, A250410, A250411, A099165, A250412.
%K A259385 nonn,base
%O A259385 1,3
%A A259385 Eric A. Schmidt and _Robert G. Wilson v_, Jul 16 2015