login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A317750
a(n) is the least nonnegative integer, not yet present in the sequence, such that sums of some of the terms up to a(n) produce exactly n distinct primes.
0
0, 2, 1, 3, 4, 48, 152, 1762, 9792, 303074, 49728560
OFFSET
0,2
COMMENTS
Collected primes from a(1) on: 2, 3, 5, 7, 53, 157, 1811, 9949, 303283, 49730477, ...
If we drop the unicity constraint, then we obtain: 0, 2, followed by the prime gaps (A001223). - Rémy Sigrist, Aug 07 2018
a(11) > 1.3*10^10. - Giovanni Resta, Aug 09 2018
EXAMPLE
a(0) = 0, no prime.
a(1) = 2, one prime: 2.
a(2) = 1, two primes: 2 and 1 + 2 = 3.
a(3) = 3, three primes: 2, 3 and 3 + 2 = 5.
a(4) = 4, four primes: 2, 3, 3 + 2 = 4 + 1 = 5 and 4 + 3 = 4 + 2 + 1 = 7.
Next term is a(5) = 48 because any integer from 5 to 47 generates more than 5 primes. For instance, 33 gives 33 + 4 = 37 and 33 + 4 + 3 + 1 = 41 that with 2, 3, 5 and 7 sum to 6 primes.
MAPLE
with(combinat): P:=proc(q) local a, c, d, f, g, j, k, n, ok, x; a:=[0, 2]; print(0); print(2); x:=1; for n from 2 to q do for j from x to q do if numboccur(a, j)=0 then c:=[op(a), j]; d:=choose(c); f:={}; for k from 1 to nops(d) do g:=convert(d[k], `+`); if isprime(g) then f:=f union {g}; fi; od; ok:=1; if nops(f)=n then for k from 1 to n do if numboccur(f, f[k])>1 then ok:=0; break; fi; od; else ok:=0; fi; if ok=1 then a:=[op(a), j]; x:=j+1; print(j); break; fi; fi; od; od; end: P(10^9);
MATHEMATICA
a = s = {0}; p = {}; Do[t=1; While[MemberQ[a, t] || Length[q = Union[p, Select[s + t, PrimeQ]]] != n, t++]; AppendTo[a, t]; p = q; s = Union[s, s + t], {n, 8}]; a (* Giovanni Resta, Aug 09 2018 *)
CROSSREFS
Sequence in context: A365228 A370550 A276811 * A188732 A085189 A130466
KEYWORD
nonn,more
AUTHOR
Paolo P. Lava, Aug 06 2018
EXTENSIONS
a(10) from Giovanni Resta, Aug 07 2018
STATUS
approved