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.

A346274 Number of n-digit primes with digital product = 7.

Original entry on oeis.org

1, 2, 0, 2, 2, 0, 3, 3, 0, 2, 1, 0, 1, 0, 0, 0, 2, 0, 3, 1, 0, 3, 1, 0, 2, 1, 0, 2, 3, 0, 2, 1, 0, 2, 2, 0, 3, 0, 0, 3, 0, 0, 2, 1, 0, 3, 3, 0, 4, 4, 0, 1, 2, 0, 4, 2, 0, 1, 2, 0, 1, 2, 0, 3, 3, 0, 2, 1, 0, 2, 2, 0, 1, 3, 0, 0, 3, 0, 1, 3, 0, 2, 8, 0, 1, 3, 0
Offset: 1

Views

Author

Bernard Schott, Jul 12 2021

Keywords

Comments

Equivalently: Number of n-digit terms of A107693 that are primes.
This sequence is inspired by the 1st problem, submitted by USSR during the 31st International Mathematical Olympiad in 1990 at Beijing, but not used for the competition.
The problem was: Consider the n-digit numbers consisting of one '7' and n-1 '1'. For what values of n are all these numbers prime?
a(n) = n iff n = 1 or n = 2 (this is the answer to the Olympiad problem).
a(n) < n for n >= 3 <=> for n >= 3, there is always at least one composite number among the n-digit numbers with digital product = 7.
Steps of the proof by disjunction elimination (proof in Derek Holton in reference):
-> If n = 3*k, k>0, a(n) = 0 because the n-digit numbers with digital product = 7 are then divisible by 3.
-> If n = 4, 1117 and 1171 are primes, but 1711 = 29 * 59 and 7111 = 13 * 547; hence a(4) = 2 < 4.
-> If n > 4 and n <> 3k, there is always at least one n-digit number that is divisible by 7, these composites are in A346276.
Also, a(n) = 0 for n = 14, 16, 38, 41, 76, 104, 107, 110, 128, 134, 146, 152, 155, 164, 166, 178, 185, ... (comes from b-file in A107693).

Examples

			7 is prime, hence a(1) = 1.
17 and 71 are primes, hence a(2) = 2.
1117 and 1171 are primes, but 1711 = 29 * 59 and 7111 = 13 * 547; hence a(4) = 2.
		

References

  • Derek Holton, A Second Step to Mathematical Olympiad Problems, Vol. 7, Mathematical Olympiad Series, World Scientific, 2011, Section 8.2. USS 1 p. 260 and Section 8.14 Solutions pp 284-287.

Crossrefs

Programs

  • Mathematica
    a[n_] := Count[(10^n - 1)/9 + 6*10^Range[0, n - 1], ?PrimeQ]; Array[a, 100] (* _Amiram Eldar, Jul 12 2021 *)
  • PARI
    a(n) = {my(s = 10^n\9); sum(i = 0, n-1, isprime(s + 6*10^i))} \\ David A. Corneth, Jul 12 2021
    
  • Python
    from sympy import isprime
    def a(n):
        return sum(isprime(int('1'*(n-1-i) + '7' + '1'*i)) for i in range(n))
    print([a(n) for n in range(1, 88)]) # Michael S. Branicky, Jul 12 2021

Formula

a(3*k) = 0 for k >= 1.