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!)
A248889 Palindromic in base 10 and 18. 2
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 171, 323, 343, 505, 595, 686, 848, 1661, 2112, 3773, 23332, 46664, 69996, 262262, 583385, 782287, 859958, 981189, 1254521, 1403041, 1832381, 39388393, 54411445, 55499455, 88844888, 118919811, 191010191 (list; graph; refs; listen; history; text; internal format)
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
Sequence in context: A117057 A249516 A239090 * A029967 A029968 A097855
KEYWORD
nonn,base
AUTHOR
Mauro Fiorentini, Mar 05 2015
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 April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)