%I #37 Mar 11 2024 01:44:18
%S 1,4,22,111,121,202,1001,1111,10001,10201,11111,100001,1000001,
%T 1001001,1012101,1100011,1101011,1111111,10000001,100000001,101000101,
%U 110000011,200010002,10000000001,10011111001,11000100011,11001010011,11100100111,11101010111,20000100002
%N Nonprime palindromes n such that the product of divisors of n is also a palindrome.
%C Primes trivially satisfy this property and are therefore not included in the sequence.
%C These are the palindromes in A244411.
%H Chai Wah Wu, <a href="/A244423/b244423.txt">Table of n, a(n) for n = 1..49</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PalindromicNumber.html">Palindromic Number</a>
%H <a href="/index/Pac#palindromes">Index entries for sequences related to palindromes</a>
%e 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.
%t 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 *)
%t Select[Range[200002*10^5],!PrimeQ[#]&&AllTrue[{#,Times@@Divisors[#]},PalindromeQ]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jul 28 2020 *)
%o (PARI) rev(n)={r="";dig=digits(n);for(i=1,#dig,r=concat(Str(dig[i]),r));return(eval(r))}
%o 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,", "))))
%o (PARI) /* david(n) returns the n-th palindrome from _David A. Corneth_, Jun 06 2014 */
%o 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])}
%o rev(n)={r="";dig=digits(n);for(i=1,#dig,r=concat(Str(dig[i]),r));return(eval(r))}
%o 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,", "))))
%o (Python)
%o import sympy
%o from sympy import isprime
%o from sympy import divisors
%o def rev(n):
%o ..r = ""
%o ..for i in str(n):
%o ....r = i + r
%o ..return int(r)
%o def a():
%o ..for n in range(1,10**8):
%o ....if rev(n) == n and not isprime(n):
%o ......p = 1
%o ......for i in divisors(n):
%o ........p*=i
%o ......if rev(p)==p:
%o ........print(n,end=', ')
%o a()
%o (Python)
%o from sympy import divisor_count, sqrt
%o def palgen(l,b=10): # generator of palindromes in base b of length <= 2*l
%o if l > 0:
%o yield 0
%o for x in range(1,l+1):
%o n = b**(x-1)
%o n2 = n*b
%o for y in range(n,n2):
%o k, m = y//b, 0
%o while k >= b:
%o k, r = divmod(k,b)
%o m = b*m + r
%o yield y*n + b*m + k
%o for y in range(n,n2):
%o k, m = y, 0
%o while k >= b:
%o k, r = divmod(k,b)
%o m = b*m + r
%o yield y*n2 + b*m + k
%o A244423_list = [1]
%o for n in palgen(6):
%o d = divisor_count(n)
%o if d > 2:
%o q, r = divmod(d,2)
%o s = str(n**q*(sqrt(n) if r else 1))
%o if s == s[::-1]:
%o A244423_list.append(n) # _Chai Wah Wu_, Aug 25 2015
%Y Cf. A244411, A002113.
%K nonn,base
%O 1,2
%A _Derek Orr_, Jun 27 2014
%E Edited name by _Chai Wah Wu_, Aug 25 2015