|
|
A093301
|
|
Earliest positive integer having embedded exactly k distinct primes.
|
|
3
|
|
|
1, 2, 13, 23, 113, 137, 1131, 1137, 1373, 11379, 11317, 23719, 111317, 113171, 211373, 1113171, 1113173, 1317971, 2313797, 11131733, 11317971, 13179719, 52313797, 113179719, 113733797, 523137971, 1113173331, 1131797193, 1797193373
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
LINKS
|
Table of n, a(n) for n=0..28.
Carlos Rivera, Puzzle 265. Primes embedded, The Prime Puzzles & Problems Connection.
|
|
FORMULA
|
A039997(a(n)) = n and A039997(m) <> n for m < a(n). - Reinhard Zumkeller, Jul 16 2007
|
|
EXAMPLE
|
For example: a(5) = 137 because 137 is the earliest number that has embedded 5 distinct primes: 3, 7, 13, 37 & 137.
|
|
PROG
|
(PARI) dp(n)=if(n<12, return(if(isprime(n), [n], []))); my(v=vecsort(select(isprime, eval(Vec(Str(n)))), , 8), t); while(n>9, if(gcd(n%10, 10)>1, n\=10; next); t=10; while((t*=10)<n*10, if(isprime(n%t), v=concat(v, n%t))); v=vecsort(v, , 8); n\=10); v
print1(1); r=0; for(n=1, 1e6, t=#dp(n); if(t>r, r=t; print1(", "n))) \\ Charles R Greathouse IV, Jul 10 2012
(Python)
from sympy import isprime
from itertools import count, islice
def A039997(n):
s = str(n)
ss = (int(s[i:j]) for i in range(len(s)) for j in range(i+1, len(s)+1))
return len(set(k for k in ss if isprime(k)))
def agen():
adict, n = dict(), 0
for k in count(1):
v = A039997(k)
if v not in adict: adict[v] = k
while n in adict: yield adict[n]; n += 1
print(list(islice(agen(), 14))) # Michael S. Branicky, Aug 07 2022
|
|
CROSSREFS
|
Cf. A000040, A039997.
Sequence in context: A035244 A085822 A213321 * A079397 A118524 A029971
Adjacent sequences: A093298 A093299 A093300 * A093302 A093303 A093304
|
|
KEYWORD
|
base,nonn,more
|
|
AUTHOR
|
Carlos Rivera, Apr 24 2004
|
|
EXTENSIONS
|
Name clarified, offset corrected, and a(9) inserted by Michael S. Branicky, Aug 07 2022
|
|
STATUS
|
approved
|
|
|
|