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.

A250408 Palindromic in bases 10 and 20.

This page as a plain text file.
%I A250408 #20 Sep 08 2022 08:46:10
%S A250408 0,1,2,3,4,5,6,7,8,9,11,252,6556,6776,7117,10101,12621,20202,22722,
%T A250408 30303,1784871,1786871,1788871,1913191,1915191,1917191,1919191,
%U A250408 1444884441,334495594433,334843348433,355110011553,355746647553,10614366341601,14102600620141,28095922959082,38072044027083
%N A250408 Palindromic in bases 10 and 20.
%H A250408 Robert G. Wilson v, <a href="/A250408/b250408.txt">Table of n, a(n) for n = 1..85</a>
%t A250408 palQ[n_Integer, base_Integer] := Block[{}, Reverse[ idn = IntegerDigits[n, base]] == idn]; genPal[n_] := Block[{id = IntegerDigits@ n, insert = {{}, {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}}}, FromDigits@ Join[id, #, Reverse@ id] & /@ insert]; k = 1; lst = {0, 1, 2, 3,  4, 5, 6, 7, 8, 9}; While[k < 1000001, s = Select[ genPal[k], palQ[#, 20] &]; If[s != {}, AppendTo[lst, s]; Print@ s; lst = Sort@ Flatten@ lst]; k++]; lst
%t A250408 b1=10; b2=20; lst={}; Do[d1=IntegerDigits[n, b1]; d2=IntegerDigits[n, b2]; If[d1==Reverse[d1]&&d2==Reverse[d2], AppendTo[lst, n]], {n, 0, 10000000}]; lst (* _Vincenzo Librandi_, Nov 23 2014 *)
%o A250408 (Magma) [n: n in [0..10000000] | Intseq(n, 10) eq Reverse(Intseq(n, 10))and Intseq(n, 20) eq Reverse(Intseq(n, 20))]; // _Vincenzo Librandi_, Nov 23 2014
%o A250408 (Python)
%o A250408 from gmpy2 import digits
%o A250408 def palQ(n, b): # check if n is a palindrome in base b
%o A250408     s = digits(n, b)
%o A250408     return s == s[::-1]
%o A250408 def palQgen10(l): # unordered generator of palindromes of length <= 2*l
%o A250408     if l > 0:
%o A250408         yield 0
%o A250408         for x in range(1,10**l):
%o A250408             s = str(x)
%o A250408             yield int(s+s[-2::-1])
%o A250408             yield int(s+s[::-1])
%o A250408 A250408_list = sorted([n for n in palQgen10(6) if palQ(n,20)])
%o A250408 # _Chai Wah Wu_, Nov 25 2014
%Y A250408 Cf. A007632, A007633, A029961, A029962, A029963, A029964, A029804, A029965, A029966, A029967, A029968, A029969, A029970, A029731, A097855, A250409, A250410, A250411, A099165, A250412.
%K A250408 nonn,base
%O A250408 1,3
%A A250408 _Robert G. Wilson v_, Nov 22 2014