cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A370851 Lesser of two consecutive primes such that the product of its digits is also prime and that of the other is composite.

This page as a plain text file.
%I A370851 #18 Mar 26 2024 01:59:27
%S A370851 17,31,71,113,131,151,211,311,1117,1151,1171,1511,2111,11117,11131,
%T A370851 11171,11311,111121,111211,112111,113111,131111,311111,511111,1111151,
%U A370851 1111211,1111711,1117111,1171111,11111117,11111131,11111171,11111311,11113111,11131111,71111111
%N A370851 Lesser of two consecutive primes such that the product of its digits is also prime and that of the other is composite.
%e A370851 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.
%e A370851 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.
%e A370851 29 is not a term because the product of its digits is 18 and 18 is not prime.
%t A370851 Select[Prime[Range[6*10^6]], PrimeQ[Apply[Times, IntegerDigits[#]]]&&CompositeQ[Apply[Times,IntegerDigits[NextPrime[#]]]]&] (* _James C. McMahon_, Mar 03 2024 *)
%o A370851 (PARI) isok(p)=my(x=vecprod(digits(p)),y=vecprod(digits(nextprime(p+1))));isprime(x) && y>3 &&!isprime(y);
%o A370851 forprime(p=2,20000,if(isok(p),print1(p", ")))
%o A370851 (Python)
%o A370851 from math import prod
%o A370851 from itertools import count, islice
%o A370851 from sympy import isprime, nextprime
%o A370851 def A370851_gen(): # generator of terms
%o A370851     for l in count(1):
%o A370851         k = (10**l-1)//9
%o A370851         for m in range(l):
%o A370851             a = 10**m
%o A370851             for j in (1,2,4,6):
%o A370851                 p = k+a*j
%o A370851                 if isprime(p) and not (isprime(s:=prod(map(int,str(nextprime(p))))) or s==1):
%o A370851                     yield p
%o A370851 A370851_list = list(islice(A370851_gen(),20)) # _Chai Wah Wu_, Mar 25 2024
%Y A370851 Cf. A000040, A002808, A053666.
%Y A370851 Cf. also A370848, A370850.
%K A370851 nonn,base
%O A370851 1,1
%A A370851 _Claude H. R. Dequatre_, Mar 03 2024