OFFSET
1,1
COMMENTS
Conjecturally (Hardy & Littlewood conjecture F), a(n) exists for all n. - Charles R Greathouse IV, Oct 21 2014
It appears that the minimum value reached by a(n) is 6. This occurs for n=2, 16, 58, 136, 178, 418, 598, 808, ... . - Michel Marcus, Oct 26 2014
The conjecture in the previous line is true - if n is odd, then n+1 is even, n+3 is even, n+6 and n+10 are odd, etc., so a(n)>6. If n is even, then +1 and +3 are odd, +6, +10 are even, so the fourth prime can be first for a(n)=6. - Jon Perry, Oct 29 2014
Conjecture: a(n) is odd approximately 50% of the time. - Jon Perry, Oct 29 2014
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = Min_{k>0 | { n+A000217(j), j=1...k} contains four primes}. - M. F. Hasler, Oct 29 2014
EXAMPLE
a(1) = 7 because 1+1+2+3+4+5+6+7 = 29 and exactly three partial sums are prime (2,7,11).
a(2) = 6 because 2+1+2+3+4+5+6 = 23 and exactly three partial sums are prime (3,5,17).
MAPLE
f:= proc(n) local j, count;
count:= 0;
for j from 1 do
if isprime(n + j*(j+1)/2) then
count:= count+1;
if count = 4 then return j fi
fi
od
end proc:
seq(f(n), n=1..100); # Robert Israel, Oct 29 2014
MATHEMATICA
a[n_] := Module[{j, cnt = 0}, For[j = 1, True, j++, If[PrimeQ[n+j(j+1)/2], cnt++; If[cnt == 4, Return[j]]]]];
Array[a, 100] (* Jean-François Alcover, Oct 03 2020, after Maple *)
PROG
(PARI) a(n)=my(k, s=4); while(s, if(isprime(n+=k++), s--)); k \\ Charles R Greathouse IV, Oct 21 2014
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Gil Broussard, Oct 21 2014
STATUS
approved