login
A248899
Numbers that are palindromic in bases 10 and 19.
1
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 666, 838, 1771, 432234, 864468, 1551551, 1897981, 2211122, 155292551, 330050033, 453848354, 467535764, 650767056, 666909666, 857383758, 863828368, 47069796074, 62558085526, 67269596276, 87161116178, 96060106069, 121791197121, 127673376721, 139103301931, 234595595432, 246025520642
OFFSET
1,3
COMMENTS
Next term > 10^12.
EXAMPLE
838 = 262 in base 19.
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:
return true;
end proc;
Base := 19;
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
palQ[n_, b_] := Block[{d = IntegerDigits[n, b]}, If[d == Reverse@ d, True, False]]; Select[Range[0, 10^6], And[palQ[#, 10], palQ[#, 19]] &] (* Michael De Vlieger, Mar 07 2015 *)
b1=10; b2=19; lst={}; Do[d1=IntegerDigits[n, b1]; d2=IntegerDigits[n, b2]; If[d1==Reverse[d1]&&d2==Reverse[d2], AppendTo[lst, n]], {n, 0, 10^7}]; lst (* Vincenzo Librandi, Mar 08 2015 *)
PROG
(PARI) isok(n) = (n==0) || ((d = digits(n, 10)) && (Vecrev(d) == d) && (d = digits(n, 19)) && (Vecrev(d) == d)); \\ Michel Marcus, Mar 07 2015
(Magma) [n: n in [0..2*10^7] | Intseq(n) eq Reverse(Intseq(n))and Intseq(n, 19) eq Reverse(Intseq(n, 19))]; // Vincenzo Librandi, Mar 08 2015
KEYWORD
base,nonn
AUTHOR
Mauro Fiorentini, Mar 06 2015
STATUS
approved