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.

Showing 1-2 of 2 results.

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

Original entry on oeis.org

13, 17, 31, 71, 113, 1151, 11131, 112111, 113111, 131111, 1111211, 1111711, 11111117, 11111171, 71111111, 115111111, 1111111121, 1111115111, 1115111111, 1117111111, 1151111111, 1711111111, 11111111113, 11113111111, 31111111111, 111113111111, 111511111111, 1111171111111
Offset: 1

Views

Author

Claude H. R. Dequatre, Mar 03 2024

Keywords

Examples

			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.
		

Crossrefs

Cf. A370850.
Except for the first, all terms of this sequence are in A370851.

Programs

  • Mathematica
    Select[Prime[Range[5*10^6]],PrimeQ[Apply[Times,IntegerDigits[#]]]&&CompositeQ[Total[IntegerDigits[NextPrime[#]]]]&] (* James C. McMahon, Mar 03 2024 *)
  • 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
    A370848_list = list(islice(A370848_gen(),20)) # Chai Wah Wu, Mar 25 2024

Extensions

a(17)-a(21) from Michel Marcus, Mar 03 2024
a(22)-a(28) from Hugo Pfoertner, Mar 03 2024

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

Original entry on oeis.org

17, 31, 71, 113, 131, 151, 211, 311, 1117, 1151, 1171, 1511, 2111, 11117, 11131, 11171, 11311, 111121, 111211, 112111, 113111, 131111, 311111, 511111, 1111151, 1111211, 1111711, 1117111, 1171111, 11111117, 11111131, 11111171, 11111311, 11113111, 11131111, 71111111
Offset: 1

Views

Author

Claude H. R. Dequatre, Mar 03 2024

Keywords

Examples

			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.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[6*10^6]], PrimeQ[Apply[Times, IntegerDigits[#]]]&&CompositeQ[Apply[Times,IntegerDigits[NextPrime[#]]]]&] (* James C. McMahon, Mar 03 2024 *)
  • 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
    A370851_list = list(islice(A370851_gen(),20)) # Chai Wah Wu, Mar 25 2024
Showing 1-2 of 2 results.