login
A244423
Nonprime palindromes n such that the product of divisors of n is also a palindrome.
2
1, 4, 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
Primes trivially satisfy this property and are therefore not included in the sequence.
These are the palindromes in A244411.
EXAMPLE
The divisors of 22 are 1, 2, 11 and 22. 1*2*11*22 = 484 is a palindrome. Since 22 is also a palindrome, 22 is a member of this sequence.
MATHEMATICA
palQ[n_] := Block[{d = IntegerDigits@ n}, Reverse@ d == d]; lim = 15000000; Select[Complement[Range@ lim, Prime@ Range@ PrimePi@ lim], And[palQ@ #, palQ[Times @@ Divisors@ #]] &] (* Michael De Vlieger, Aug 25 2015 *)
Select[Range[200002*10^5], !PrimeQ[#]&&AllTrue[{#, Times@@Divisors[#]}, PalindromeQ]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 28 2020 *)
PROG
(PARI) rev(n)={r=""; dig=digits(n); for(i=1, #dig, r=concat(Str(dig[i]), r)); return(eval(r))}
for(n=1, 10^8, if(rev(n)==n&&(!isprime(n)), d=divisors(n); ss=prod(j=1, #d, d[j]); if(ss==rev(ss), print1(n, ", "))))
(PARI) /* david(n) returns the n-th palindrome from David A. Corneth, Jun 06 2014 */
david(n)={my(d, i, r); r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11)); n=n-10^(#digits(n\11)); d=digits(n); for(i=1, #d, r[i]=d[i]; r[#r+1-i]=d[i]); sum(i=1, #r, 10^(#r-i)*r[i])}
rev(n)={r=""; dig=digits(n); for(i=1, #dig, r=concat(Str(dig[i]), r)); return(eval(r))}
for(n=2, 10^6, pal=david(n); if(!isprime(pal), d=divisors(pal); ss=prod(j=1, #d, d[j]); if(ss==rev(ss), print1(pal, ", "))))
(Python)
import sympy
from sympy import isprime
from sympy import divisors
def rev(n):
..r = ""
..for i in str(n):
....r = i + r
..return int(r)
def a():
..for n in range(1, 10**8):
....if rev(n) == n and not isprime(n):
......p = 1
......for i in divisors(n):
........p*=i
......if rev(p)==p:
........print(n, end=', ')
a()
(Python)
from sympy import divisor_count, sqrt
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 = 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 = divmod(k, b)
m = b*m + r
yield y*n2 + b*m + k
A244423_list = [1]
for n in palgen(6):
d = divisor_count(n)
if d > 2:
q, r = divmod(d, 2)
s = str(n**q*(sqrt(n) if r else 1))
if s == s[::-1]:
A244423_list.append(n) # Chai Wah Wu, Aug 25 2015
CROSSREFS
Sequence in context: A007994 A006651 A159616 * A144047 A077543 A084157
KEYWORD
nonn,base
AUTHOR
Derek Orr, Jun 27 2014
EXTENSIONS
Edited name by Chai Wah Wu, Aug 25 2015
STATUS
approved