login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A250408 Palindromic in bases 10 and 20. 21
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 252, 6556, 6776, 7117, 10101, 12621, 20202, 22722, 30303, 1784871, 1786871, 1788871, 1913191, 1915191, 1917191, 1919191, 1444884441, 334495594433, 334843348433, 355110011553, 355746647553, 10614366341601, 14102600620141, 28095922959082, 38072044027083 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..85
MATHEMATICA
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
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 *)
PROG
(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
(Python)
from gmpy2 import digits
def palQ(n, b): # check if n is a palindrome in base b
s = digits(n, b)
return s == s[::-1]
def palQgen10(l): # unordered generator of palindromes of length <= 2*l
if l > 0:
yield 0
for x in range(1, 10**l):
s = str(x)
yield int(s+s[-2::-1])
yield int(s+s[::-1])
A250408_list = sorted([n for n in palQgen10(6) if palQ(n, 20)])
# Chai Wah Wu, Nov 25 2014
CROSSREFS
Sequence in context: A029967 A029968 A097855 * A029969 A029731 A248899
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Nov 22 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 16 12:29 EDT 2024. Contains 375966 sequences. (Running on oeis4.)