OFFSET
1,2
COMMENTS
EXAMPLE
a(3) = 6 because the sum of the first 6 triprimes is 8 + 12 + 18 + 20 + 27 + 28 = 113 which is prime, and none of the previous partial sums is prime.
MAPLE
f:= proc(n)
uses priqueue;
local pq, t, s, count, v, w, p, i;
initialize(pq);
insert([-2^n, [2$n]], pq);
s:= 0;
for count from 1 do
t:= extract(pq);
v:= -t[1];
w:= t[2];
s:= s+v;
if isprime(s) then return count fi;
p:= nextprime(w[-1]);
for i from n to 1 by -1 while w[i] = w[n] do
insert([t[1]*(p/w[-1])^(n+1-i), [op(w[1..i-1]), p$(n+1-i)]], pq);
od od;
end proc:
map(f, [$1..36]);
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Sep 24 2024
STATUS
approved