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-3 of 3 results.

A107693 Primes with digital product = 7.

Original entry on oeis.org

7, 17, 71, 1117, 1171, 11117, 11171, 1111711, 1117111, 1171111, 11111117, 11111171, 71111111, 1117111111, 1711111111, 17111111111, 1111171111111, 11111111111111171, 11111111171111111, 1111111111111111171, 1111171111111111111, 1111711111111111111
Offset: 1

Views

Author

Zak Seidov and Robert G. Wilson v, May 20 2005

Keywords

Comments

Subsequence of A034054. - Michel Marcus, Jul 27 2016
From Bernard Schott, Jul 12 2021: (Start)
This sequence was the subject of the 1st problem, submitted by USSR, during the 31st International Mathematical Olympiad in 1990 at Beijing, but the jury decided not to use it in the competition.
Problem was: Consider the m-digit numbers consisting of one '7' and m-1 '1'. For what values of m are all these numbers prime? (see the reference).
Answer is: only for m = 1 and m = 2, all these m-digit numbers are primes, so, a(1) = 7, then a(2) = 17 and a(3) = 71.
For other results, see A346274. (End)

Examples

			1117 and 1171 are primes, but 1711 = 29 * 59 and 7111 = 13 * 547; hence a(4) = 1117 and a(5) = 1171.
		

References

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

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(3*10^8) | &*Intseq(p) eq 7]; // Vincenzo Librandi, Jul 27 2016
    
  • Mathematica
    Flatten[ Table[ Select[ Sort[ FromDigits /@ Permutations[ Flatten[{7, Table[1, {n}]}]]], PrimeQ[ # ] &], {n, 0, 20}]]
    Select[Prime[Range[3 10^6]], Times@@IntegerDigits[#] == 7 &] (* Vincenzo Librandi, Jul 27 2016 *)
    Sort[Flatten[Table[Select[FromDigits/@Permutations[PadRight[{7},n,1]],PrimeQ],{n,20}]]] (* Harvey P. Dale, Aug 19 2021 *)
  • Python
    from sympy import isprime
    def auptod(maxdigits):
        alst = []
        for d in range(1, maxdigits+1):
            if d%3 == 0: continue
            for i in range(d):
                t = int('1'*(d-1-i) + '7' + '1'*i)
                if isprime(t): alst.append(t)
        return alst
    print(auptod(20))  # Michael S. Branicky, Jul 12 2021

Extensions

a(21) and beyond from Michael S. Branicky, Jul 12 2021

A346276 Composite m-digit numbers with m <> 3k and digital product = 7 that are divisible by 7.

Original entry on oeis.org

11711, 1111117, 7111111, 11171111, 1111711111, 11111111711, 11711111111, 1111111111117, 1111117111111, 7111111111111, 11111111171111, 11171111111111, 1111111111711111, 1111711111111111, 11111111111111711, 11111111711111111, 11711111111111111, 1111111111111111117, 1111111111117111111
Offset: 1

Views

Author

Bernard Schott, Jul 22 2021

Keywords

Comments

Proposition: when m > 4 and m <> 3k, there is always at least one m-digit number that is divisible by 7 (proof in Derek Holton in reference), these composites are in this sequence (see A346274).
Every term has m = 5+6r, resp. (7+6r, 8+6r, 10+6r (r>=0)) digits and comes from the concatenation of a(1) = 11711, resp. (7, a(4) = 11171111, a(5) = 1111711111) with one or more strings of R_6 = 111111 = 7*15873 placed before and/or after a(1), resp. (7, a(4), a(5)).
The corresponding smallest term b(m) with m = 5+6r, resp. (7+6r, 8+6r, 10+6r (r>=0)) digits is b(m) = R_m + 6*10^k with k = 2, resp. (0, 4, 5) with R_m = A002275(m) is the repunit with a string of m 1's.
Alternatively, numbers viewed as strings over {1, 7} divisible by 7 are accepted by an automaton with 12 states, {0..6, 0'..6'} - {3, 3'}, with k (resp. k') representing remainder mod 7 where 7 has not (resp. has) been seen; transition function delta(k, 1) = 10*k+1 mod 7, delta(k, 7) = (10*k+7 mod 7)', delta(k', 1) = 10*k'+1 mod 7; start state 0; and accept state 0'. Accepted strings satisfy the regular expression (111111)*(7 + 11711 + 11171111 + 1111711111 + 111117111)(111111)*. This sequence includes all terms matching (111111)*(7 + 11711 + 11171111 + 1111711111)(111111)* except the number 7 alone. - Michael S. Branicky, Jul 22 2021

Examples

			a(1) = 11711 because 11711 has 5 digits, a digital product = 7 and 11711 = 7^2 * 239.
		

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
    seq[digmax_] := Module[{dig = Select[Range[5, digmax], Mod[#, 3] > 0 &], s = {}}, Do[s = Join[s, Select[(10^d - 1)/9 + 6*10^Range[0, d - 1], Divisible[#, 7] &]], {d, dig}]; s]; seq[19] (* Amiram Eldar, Jul 22 2021 *)
  • PARI
    a(n) = { my(q = floor((-3+sqrt(1+8*n))/4), s = [1, 2, 1, 1] + [1, 1, 1, 1] * q, c, b = [2, 0, 4, 5]); n -= (2*q^2 + 3*q); for(i = 1, 4, if(s[i] < n, n-=s[i] , c = i; break; ) ); qd = ceil(6*q + 3*c/2+7/2); 10^qd\9 + 6*10^(6*(n-1)+b[c]) } \\ David A. Corneth, Jul 23 2021
  • Python
    from sympy import isprime
    def auptod(digs):
      return [t for t in (int('1'*(m-1-i) + '7' + '1'*i) for m in range(5, digs+1) if m%3 != 0 for i in range(m)) if t%7 == 0]
    print(auptod(19)) # Michael S. Branicky, Jul 22 2021
    

A346275 Number of n-digit primes with digital product = 3.

Original entry on oeis.org

1, 2, 3, 0, 3, 3, 0, 4, 4, 0, 5, 2, 0, 1, 0, 0, 1, 2, 0, 3, 1, 0, 2, 1, 0, 0, 1, 0, 4, 3, 0, 0, 1, 0, 4, 3, 0, 1, 6, 0, 0, 4, 0, 2, 1, 0, 2, 6, 0, 2, 2, 0, 5, 3, 0, 4, 3, 0, 3, 1, 0, 1, 3, 0, 1, 4, 0, 0, 2, 0, 3, 4, 0, 4, 1, 0, 2, 4, 0, 3, 2, 0, 1, 6, 0, 2, 3, 0, 3, 4, 0
Offset: 1

Views

Author

Bernard Schott, Jul 13 2021

Keywords

Comments

Equivalently: Number of n-digit terms of A107689 that are primes.
This sequence is similar to A346274 where digital product = 7.
a(n) = n if n = 1 or n = 2 or n = 3.
Conjecture: for n >= 4, there is at least one composite number among the n-digit numbers with digital product = 3 <==> a(n) < n for n >= 4 (guess proposed by Derek Holton in reference).
Also a(n) = 0 for n = 15, 26, 32, 68, ...

Examples

			3 is prime, hence a(1) = 1.
13 and 31 are primes, hence a(2) = 2.
11113, 11131, 11311 are primes, but 13111 =  7*1873 and 31111 = 53*587, hence a(5) = 3.
		

References

  • Derek Holton, A Second Step to Mathematical Olympiad Problems, Vol. 7, Mathematical Olympiad Series, World Scientific, 2011, Section 8.14 - 69, page 287.

Crossrefs

Programs

  • Mathematica
    a[n_] := Count[(10^n - 1)/9 + 2*10^Range[0, n - 1], ?PrimeQ]; Array[a, 100] (* _Amiram Eldar, Jul 13 2021 *)
  • Python
    from sympy import isprime
    def a(n): return sum(isprime(int('1'*(n-1-i)+'3'+'1'*i)) for i in range(n))
    print([a(n) for n in range(1, 92)]) # Michael S. Branicky, Jul 13 2021

Formula

a(3*k+1) = 0 for k > 0.
Showing 1-3 of 3 results.