OFFSET
1,1
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 1..3701
EXAMPLE
13 is a term because 13 is prime, the product of its digits is 3 which is also prime and the sum of the digits of 17, the next prime to 13, is 8 which is composite.
23 is not a term because the product of its digits is 6 which is not prime.
131 is not a term because although it is prime and the product of its digits is 3 which is also prime, the sum of the digits of 137, the next prime to 131, is 11 which is not composite.
MATHEMATICA
Select[Prime[Range[5*10^6]], PrimeQ[Apply[Times, IntegerDigits[#]]]&&CompositeQ[Total[IntegerDigits[NextPrime[#]]]]&] (* James C. McMahon, Mar 03 2024 *)
PROG
(PARI) isok(p)=my(x=vecprod(digits(p)), y=sumdigits(nextprime(p+1))); isprime(x) && !isprime(y);
forprime(p=2, 20000, if(isok(p), print1(p", ")))
(PARI) a370848(maxdigits=20) = {my (L=List()); for (n=2, maxdigits, my (r=(10^n-1)/9, d=digits(r)); foreach ([2, 3, 5, 7], s, for (k=1, #d, my (dd=d); dd[k]=s; my(q=fromdigits(dd)); if (ispseudoprime(q) && ! isprime(sumdigits(nextprime(q+1))), listput(L, q))))); vecsort(Vec(L))};
a370848() \\ Hugo Pfoertner, Mar 03 2024
(Python)
from itertools import count, islice
from sympy import isprime, nextprime
def A370848_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(sum(map(int, str(nextprime(p))))):
yield p
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Claude H. R. Dequatre, Mar 03 2024
EXTENSIONS
a(17)-a(21) from Michel Marcus, Mar 03 2024
a(22)-a(28) from Hugo Pfoertner, Mar 03 2024
STATUS
approved