OFFSET
1,3
COMMENTS
a(54) > 10^12.
LINKS
M. Fiorentini and Chai Wah Wu, Table of n, a(n) for n = 1..68 a(n) for n = 1..53 from M. Fiorentini.
EXAMPLE
848 in decimal is 2B2 in base 18, so 848 is in the sequence.
1661 in decimal is 525 in base 18, so 1661 is in the sequence.
1771 in decimal is 587 in base 18, which is not a palindrome, so 1771 is not in the sequence.
MAPLE
IsPalindromic := proc(n, Base)
local Conv, i;
Conv := convert(n, base, Base);
for i from 1 to nops(Conv) / 2 do
if Conv [i] <> Conv [nops(Conv) + 1 - i] then
return false;
fi:
od:
true;
end proc:
Base := 18;
A := [];
for i from 1 to 10^6 do:
S := convert(i, base, 10);
V := 0;
if i mod 10 = 0 then
next;
fi;
for j from 1 to nops(S) do:
V := V * 10 + S [j];
od:
for j from 0 to 10 do:
V1 := V * 10^(nops(S) + j) + i;
if IsPalindromic(V1, Base) then
A := [op(A), V1];
fi;
od:
V1 := (V - (V mod 10)) * 10^(nops(S) - 1) + i;
if IsPalindromic(V1, Base) then
A := [op(A), V1];
fi;
od:
sort(A);
MATHEMATICA
palindromicQ[n_, b_:10] := TrueQ[IntegerDigits[n, b] == Reverse[IntegerDigits[n, b]]]; Select[Range[0, 499], palindromicQ[#] && palindromicQ[#, 18] &] (* Alonso del Arte, Mar 21 2015 *)
PROG
(PARI) isok(n) = (n==0) || ((d = digits(n, 10)) && (Vecrev(d) == d) && (d = digits(n, 18)) && (Vecrev(d) == d)); \\ Michel Marcus, Mar 14 2015
(Magma) [n: n in [0..2*10^7] | Intseq(n) eq Reverse(Intseq(n)) and Intseq(n, 18) eq Reverse(Intseq(n, 18))]; // Vincenzo Librandi, Mar 21 2015
(Python)
def palgen10(l): # generator of palindromes of length <= 2*l
....if l > 0:
........yield 0
........for x in range(1, l+1):
............n = 10**(x-1)
............n2 = n*10
............for y in range(n, n2):
................s = str(y)
................yield int(s+s[-2::-1])
............for y in range(n, n2):
................s = str(y)
................yield int(s+s[::-1])
def palcheck(n, b): # check if n is a palindrome in base b
....s = digits(n, b)
....return s == s[::-1]
A248889_list = [n for n in palgen10(9) if palcheck(n, 18)]
# Chai Wah Wu, Mar 23 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Mauro Fiorentini, Mar 05 2015
STATUS
approved