cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A248889 Palindromic in base 10 and 18.

Original entry on oeis.org

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
Offset: 1

Views

Author

Mauro Fiorentini, Mar 05 2015

Keywords

Comments

a(54) > 10^12.

Examples

			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.
		

Crossrefs

Programs

  • 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
    
  • 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 *)
  • PARI
    isok(n) = (n==0) || ((d = digits(n, 10)) && (Vecrev(d) == d) && (d = digits(n, 18)) && (Vecrev(d) == d)); \\ Michel Marcus, Mar 14 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
Showing 1-1 of 1 results.