%I #31 Sep 08 2022 08:46:10
%S 0,1,2,3,4,5,6,7,8,9,11,22,494,626,676,1001,6886,7887,8338,9339,
%T 622226,626626,2828282,2859582,3304033,3309033,3330333,3335333,
%U 3361633,3366633,3392933,3397933,6603066,6608066,6634366,6639366,8986898,9400049,9405049,9431349,9436349,9462649,9467649,9493949,9498949
%N Numbers palindromic in bases 10 and 25.
%H 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 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 (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 (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 palQgen10(l): # unordered generator of palindromes of length <= 2*l
%o if l > 0:
%o yield 0
%o for x in range(1,10**l):
%o s = str(x)
%o yield int(s+s[-2::-1])
%o yield int(s+s[::-1])
%o A250410_list = sorted([n for n in palQgen10(6) if palQ(n,25)])
%o # _Chai Wah Wu_, Nov 25 2014
%Y Cf. A007632, A007633, A029961, A029962, A029963, A029964, A029804, A029965, A029966, A029967, A029968, A029969, A029970, A029731, A097855, A250408, A250409, A250411, A099165, A250412.
%K nonn,base
%O 1,3
%A _Robert G. Wilson v_, Nov 22 2014