OFFSET
1,1
EXAMPLE
17 is a term because 17 is prime, the product of its digits is 7 which is prime and the product of the digits of 19, the next prime to 17, is 9 and 9 is composite.
13 is not a term because although it is prime and the product of its digits is 3 which is also prime, the product of the digits of 17, the next prime to 13, is 7 and 7 is not composite.
29 is not a term because the product of its digits is 18 and 18 is not prime.
MATHEMATICA
Select[Prime[Range[6*10^6]], PrimeQ[Apply[Times, IntegerDigits[#]]]&&CompositeQ[Apply[Times, IntegerDigits[NextPrime[#]]]]&] (* James C. McMahon, Mar 03 2024 *)
PROG
(PARI) isok(p)=my(x=vecprod(digits(p)), y=vecprod(digits(nextprime(p+1)))); isprime(x) && y>3 &&!isprime(y);
forprime(p=2, 20000, if(isok(p), print1(p", ")))
(Python)
from math import prod
from itertools import count, islice
from sympy import isprime, nextprime
def A370851_gen(): # generator of terms
for l in count(1):
k = (10**l-1)//9
for m in range(l):
a = 10**m
for j in (1, 2, 4, 6):
p = k+a*j
if isprime(p) and not (isprime(s:=prod(map(int, str(nextprime(p))))) or s==1):
yield p
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Claude H. R. Dequatre, Mar 03 2024
STATUS
approved