This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A121862 #19 Aug 27 2017 19:53:38 %S A121862 1,2,6,8,4,14,10,12,20,18,16,24,26,28,32,34,36,38,22,30,48,56,54,46, %T A121862 44,42,60,40,50,58,66,62,52,68,64,84,90,72,92,70,96,80,94,78,104,76, %U A121862 74,106,102,110,88,98,82,108,114,126,116,118,86,100,120,144,122,130,128,136 %N A121862 Least previously nonoccurring positive integer such that partial sum + 2 is prime. %C A121862 The sequence is the union of {1} and a permutation of even positive integers. The corresponding partial sums + 1 are 3, 5, 11, 19, 23, 37, 47, 59, 79, 97, 113, 137, 163, 191, 223. See A084758. - _Zak Seidov_, Feb 10 2015 %C A121862 Or, first differences of A084758. - _Zak Seidov_, Feb 10 2015 %H A121862 Chai Wah Wu, <a href="/A121862/b121862.txt">Table of n, a(n) for n = 1..10000</a> %F A121862 a(n) = MIN{k>0 such that 2 + k + SUM[i=1..n-1]a(i) is prime and k <> a(i)}. %e A121862 a(1) = 1 because 1+2 = 3 is prime. %e A121862 a(2) = 2 because 1+2+2 = 5 is prime. %e A121862 a(3) = 6 because 1+2+6+2 = 11 is prime. %e A121862 a(4) = 8 because 1+2+6+8+2 = 19 is prime. %e A121862 a(5) = 4 because 1+2+6+8+4+2 = 23 is prime. %p A121862 M:= 300: # to get all entries before the first entry > N %p A121862 a[1]:= 1: %p A121862 s:= 3: %p A121862 R:= {seq(2*i,i=1..M/2)}: %p A121862 found:= true: %p A121862 for n from 2 while found do %p A121862 found:= false; %p A121862 for r in R do %p A121862 if isprime(s+r) then %p A121862 a[n]:= r; %p A121862 s:= s + r; %p A121862 R:= R minus {r}; %p A121862 found:= true; %p A121862 break %p A121862 fi %p A121862 od: %p A121862 od: %p A121862 seq(a[i],i=1..n-2); # _Robert Israel_, Feb 10 2015 %t A121862 f[s_] := Append[s, k = 1; p = 2 + Plus @@ s; While[MemberQ[s, k] || ! PrimeQ[p + k], k++ ]; k]; Nest[f, {}, 67] (* _Robert G. Wilson v_, Aug 31 2006 *) %Y A121862 Cf. A000040, A121861. %Y A121862 Cf. A084758. - _Zak Seidov_, Feb 10 2015 %K A121862 easy,nonn %O A121862 1,2 %A A121862 _Jonathan Vos Post_, Aug 30 2006 %E A121862 More terms from _Robert G. Wilson v_, Aug 31 2006