%I #19 Aug 22 2022 19:25:26
%S 1,2,4,6,11,22,44,66,111,121,141,161,212,232,242,272,292,323,343,383,
%T 414,464,474,545,565,616,626,636,656,747,838,848,878,898,929,969,1111,
%U 1221,1441,1661,2112,2222,2332,2552,2772,2882,3223,3883,4114,4444,4554
%N Palindromes such that the product of the digits + 1 is prime.
%H J.W.L. (Jan) Eerland, <a href="/A084979/b084979.txt">Table of n, a(n) for n = 1..10928</a>
%F a(n) >> n^k, where k = log_3(10) = 2.0959.... - _Charles R Greathouse IV_, Aug 02 2010
%e 383 is a term since 3*8*3 = 72, 72+1 = 73 is prime.
%t Select[ Range[4663], FromDigits[ Reverse[ IntegerDigits[ # ]]] == # && PrimeQ[1 + Times @@ IntegerDigits[ # ]] & ]
%t Parallelize[While[True,If[PalindromeQ[n]&&PrimeQ[1+Product[Part[IntegerDigits[n],k],{k,1,Length[IntegerDigits[n]]}]],Print[n]];n++];n] (* _J.W.L. (Jan) Eerland_, Dec 27 2021 *)
%o (Python)
%o from math import prod
%o from sympy import isprime
%o from itertools import count, islice, product
%o def cond(n): return isprime(prod(map(int, str(n))) + 1)
%o def pals(): # generator of palindromes as strings
%o digits = "0123456789"
%o for d in count(1):
%o for p in product(digits, repeat=d//2):
%o if d > 1 and p[0] == "0": continue
%o left = "".join(p); right = left[::-1]
%o for mid in [[""], digits][d%2]:
%o yield int(left + mid + right)
%o def agen(): yield from filter(cond, pals())
%o print(list(islice(agen(), 51))) # _Michael S. Branicky_, Aug 22 2022
%Y Cf. A081988.
%K nonn,base
%O 1,2
%A Meenakshi Srikanth (menakan_s(AT)yahoo.com), Jun 21 2003
%E Edited, corrected and extended by _Robert G. Wilson v_, Jun 21 2003
%E Formula by _Charles R Greathouse IV_, Aug 02 2010
|