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.

A261534 Nonprime palindromes n with only the digits 0, 1, 2 such that the product of divisors of n is also a palindrome.

Original entry on oeis.org

1, 22, 111, 121, 202, 1001, 1111, 10001, 10201, 11111, 100001, 1000001, 1001001, 1012101, 1100011, 1101011, 1111111, 10000001, 100000001, 101000101, 110000011, 200010002, 10000000001, 10011111001, 11000100011, 11001010011, 11100100111, 11101010111, 20000100002
Offset: 1

Views

Author

Chai Wah Wu, Aug 31 2015

Keywords

Comments

A subsequence of A244423.

Crossrefs

Programs

  • Mathematica
    lim = 1000000; palQ[n_] := Block[{d = IntegerDigits@ n}, d == Reverse@ d]; c = Complement[Range@ lim, Prime@ Range@ PrimePi@ lim]; t = Select[c, Total@ Take[RotateRight@ DigitCount@ #, -7] == 0 &]; Select[t, palQ[Times @@ Divisors@ #] &] (* Michael De Vlieger, Sep 02 2015 *)
    Rest[Select[FromDigits/@Tuples[{0,1,2},11],!PrimeQ[#]&&AllTrue[{#,Times@@ Divisors[ #]},PalindromeQ]&]] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Feb 02 2020 *)
  • Python
    from _future_ import division
    from sympy import divisor_count
    from gmpy2 import isqrt, t_divmod, digits
    def palgen(l,b=10): # generator of palindromes in base b of length <= 2*l
        if l > 0:
            yield 0
            for x in range(1,l+1):
                n = b**(x-1)
                n2 = n*b
                for y in range(n,n2):
                    k, m = y//b, 0
                    while k >= b:
                        k, r = t_divmod(k,b)
                        m = b*m + r
                    yield y*n + b*m + k
                for y in range(n,n2):
                    k, m = y, 0
                    while k >= b:
                        k, r = t_divmod(k,b)
                        m = b*m + r
                    yield y*n2 + b*m + k
    A261534_list = [1]
    for m in palgen(17,3):
        n = int(digits(m,3))
        d = int(divisor_count(n))
        if d > 2:
            q, r = t_divmod(d,2)
            s = digits(n**q*(isqrt(n) if r else 1))
            if s == s[::-1]:
                A261534_list.append(n)