A107693 Primes with digital product = 7.
7, 17, 71, 1117, 1171, 11117, 11171, 1111711, 1117111, 1171111, 11111117, 11111171, 71111111, 1117111111, 1711111111, 17111111111, 1111171111111, 11111111111111171, 11111111171111111, 1111111111111111171, 1111171111111111111, 1111711111111111111
Offset: 1
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.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..1318 (all terms with <= 1000 digits)
- Index to sequences related to Olympiads.
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
Comments