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.

A250410 Numbers palindromic in bases 10 and 25.

This page as a plain text file.
%I A250410 #31 Sep 08 2022 08:46:10
%S A250410 0,1,2,3,4,5,6,7,8,9,11,22,494,626,676,1001,6886,7887,8338,9339,
%T A250410 622226,626626,2828282,2859582,3304033,3309033,3330333,3335333,
%U A250410 3361633,3366633,3392933,3397933,6603066,6608066,6634366,6639366,8986898,9400049,9405049,9431349,9436349,9462649,9467649,9493949,9498949
%N A250410 Numbers palindromic in bases 10 and 25.
%H A250410 Robert G. Wilson v, <a href="/A250410/b250410.txt">Table of n, a(n) for n = 1..94</a> (first 82 terms from Chai Wah Wu)
%t A250410 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[#, 25] &]; If[s != {}, AppendTo[lst, s]; Print@ s; lst = Sort@ Flatten@ lst]; k++]; lst
%o A250410 (Magma) [n: n in [0..10000000] | Intseq(n) eq Reverse(Intseq(n))and Intseq(n, 25) eq Reverse(Intseq(n, 25))]; // _Vincenzo Librandi_, Nov 23 2014
%o A250410 (Python)
%o A250410 from gmpy2 import digits
%o A250410 def palQ(n,b): # check if n is a palindrome in base b
%o A250410     s = digits(n,b)
%o A250410     return s == s[::-1]
%o A250410 def palQgen10(l): # unordered generator of palindromes of length <= 2*l
%o A250410     if l > 0:
%o A250410         yield 0
%o A250410         for x in range(1,10**l):
%o A250410             s = str(x)
%o A250410             yield int(s+s[-2::-1])
%o A250410             yield int(s+s[::-1])
%o A250410 A250410_list = sorted([n for n in palQgen10(6) if palQ(n,25)])
%o A250410 # _Chai Wah Wu_, Nov 25 2014
%Y A250410 Cf. A007632, A007633, A029961, A029962, A029963, A029964, A029804, A029965, A029966, A029967, A029968, A029969, A029970, A029731, A097855, A250408, A250409, A250411, A099165, A250412.
%K A250410 nonn,base
%O A250410 1,3
%A A250410 _Robert G. Wilson v_, Nov 22 2014