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”).

Palindromic in bases 5 and 7.
20

%I #33 Apr 09 2020 10:28:00

%S 0,1,2,3,4,6,24,57,78,114,342,624,856,1432,10308,12654,27616,100056,

%T 537856,593836,769621,1434168,1473368,1636104,1823544,1862744,

%U 17968646,18108296,22412057,34713713,34853363,39280254,159690408,663706192

%N Palindromic in bases 5 and 7.

%C Intersection of A029952 and A029954.

%H G. Resta, <a href="/A249156/b249156.txt">Table of n, a(n) for n = 1..72</a> (first 60 terms from Ray Chandler)

%H Attila Bérczes and Volker Ziegler, <a href="http://arxiv.org/abs/1403.0787">On Simultaneous Palindromes</a>, arXiv:1403.0787 [math.NT], 2014.

%e 114 is a term since 114 = 424 base 5 and 114 = 222 base 7.

%t palQ[n_Integer,base_Integer]:=Block[{idn=IntegerDigits[n,base]},idn==Reverse[idn]];Select[Range[10^6]-1,palQ[#,5]&&palQ[#,7]&]

%o (Python)

%o from gmpy2 import digits

%o def palQ(n,b): # check if n is a palindrome in base b

%o s = digits(n,b)

%o return s == s[::-1]

%o def palQgen(l,b): # unordered generator of palindromes in base b of length <= 2*l

%o if l > 0:

%o yield 0

%o for x in range(1,b**l):

%o s = digits(x,b)

%o yield int(s+s[-2::-1],b)

%o yield int(s+s[::-1],b)

%o A249156_list = sorted([n for n in palQgen(8,5) if palQ(n,7)]) # _Chai Wah Wu_, Nov 25 2014

%o (PARI) isok(n) = my(df = digits(n, 5), ds = digits(n, 7)); (Vecrev(df)==df) && (Vecrev(ds)==ds); \\ _Michel Marcus_, Oct 31 2017

%Y Cf. A007632, A060792, A249155, A249157, A249158.

%K nonn,base

%O 1,3

%A _Ray Chandler_, Oct 27 2014