login
a(1)=1 and, for n>1, a(n) is the smallest positive integer such that 1+Sum[k, k=a(n-1)+1,...,a(n)] is prime.
3

%I #5 Feb 19 2017 21:36:59

%S 1,2,5,6,13,22,25,34,37,46,58,61,73,97,106,142,145,178,181,193,202,

%T 205,217,226,238,253,277,286,298,313,346,358,382,385,394,430,433,442,

%U 466,502,529,541,553,562,565,586,682,685,694,697,709,718,721,733,838,841

%N a(1)=1 and, for n>1, a(n) is the smallest positive integer such that 1+Sum[k, k=a(n-1)+1,...,a(n)] is prime.

%C It appears that, for n>4, all differences a(n+1)-a(n) are multiples of 3. The sequence of differences is A087129.

%C This is true because if a(n-1) == 1 (mod 3), 1 + Sum(k,k=a(n-1+1..t) == 2 (t^2+t) mod 3, so this would be divisible by 3 unless t == 1 (mod 3). - _Robert Israel_, Feb 19 2017

%H Robert Israel, <a href="/A087128/b087128.txt">Table of n, a(n) for n = 1..10000</a>

%e a(2)=2 since 1+(2)=3 is prime. a(3)=5 since 1+(3+4+5)=13 is prime.

%p A[1]:= 1:

%p for n from 2 to 100 do

%p for b from A[n-1]+1 do

%p if isprime(1+(1+A[n-1]+b)*(b-A[n-1])/2) then A[n]:= b; break fi

%p od od:

%p seq(A[n],n=1..100); # _Robert Israel_, Feb 19 2017

%K nonn

%O 1,2

%A _John W. Layman_, Aug 16 2003