login
A261534
Nonprime palindromes n with only the digits 0, 1, 2 such that the product of divisors of n is also a palindrome.
1
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,2
COMMENTS
A subsequence of A244423.
LINKS
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 *)
PROG
(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)
CROSSREFS
Sequence in context: A373132 A373130 A233299 * A041938 A084013 A083123
KEYWORD
nonn,base
AUTHOR
Chai Wah Wu, Aug 31 2015
STATUS
approved