cp's OEIS Frontend

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.

A121861 Least previously nonoccurring positive integer such that partial sum + 1 is prime.

This page as a plain text file.
%I A121861 #12 May 03 2017 07:54:25
%S A121861 1,3,2,4,6,12,8,10,14,18,22,26,24,16,30,32,28,20,34,36,42,44,46,62,52,
%T A121861 38,60,48,58,56,54,40,50,64,68,72,76,84,66,96,74,70,80,100,86,78,88,
%U A121861 104,90,106,122,112,98,102,94,92,118,114,108,110,124,116,138,82,120,128,150
%N A121861 Least previously nonoccurring positive integer such that partial sum + 1 is prime.
%C A121861 Conjecture: a(n) = {1,3} UNION {permutation of even positive numbers}.
%C A121861 The corresponding partial sums + 1 are 2, 5, 7, 13, 17, 29, 37, 47, 61, 79, 101, 127, 151, ...,.
%H A121861 Robert Israel, <a href="/A121861/b121861.txt">Table of n, a(n) for n = 1..10000</a>
%F A121861 a(n) = MIN{k>0 such that 1 + k + SUM[i=1..n-1]a(i) is prime and k <> a(i)}.
%e A121861 a(1) = 1 because 1+1 = 2 is prime.
%e A121861 a(2) = 3 because 1+3+1 = 5 is prime.
%e A121861 a(3) = 2 because 1+3+2+1 = 7 is prime.
%e A121861 a(4) = 4 because 1+3+2+4+1 = 11 is prime.
%p A121861 N:= 200: # to get all terms before the first term > N
%p A121861 A[1]:= 1: A[2]:= 3: P:= 5; S:= [seq(2*i,i=1..N/2)]:
%p A121861 for n from 3 while assigned(A[n-1]) do
%p A121861   for k from 1 to nops(S) do
%p A121861     if isprime(P+S[k]) then
%p A121861       A[n]:= S[k];
%p A121861       P:= P + S[k];
%p A121861       S:= subsop(k=NULL,S);
%p A121861       break
%p A121861     fi
%p A121861   od;
%p A121861 od:
%p A121861 seq(A[i],i=1..n-2); # _Robert Israel_, May 02 2017
%t A121861 f[s_] := Append[s, k = 1; p = 1 + Plus @@ s; While[MemberQ[s, k] || ! PrimeQ[p + k], k++ ]; k]; Nest[f, {}, 67] (* _Robert G. Wilson v_ *)
%Y A121861 Cf. A000040, A121862.
%K A121861 easy,nonn
%O A121861 1,2
%A A121861 _Jonathan Vos Post_, Aug 30 2006
%E A121861 Corrected and extended by _Robert G. Wilson v_, Aug 31 2006
%E A121861 Comment edited by _Robert Israel_, May 02 2017