%I
%S 2,1,4,3,6,8,9,5,10,12,14,15,16,7,18,20,21,22,24,25,26,11,27,28,30,32,
%T 33,34,35,36,38,39,40,13,42,44,45,46,48,49,50,51,52,54,55,56,57,17,58,
%U 60,62,63,64,65,66,68,69,70,72,74,75,76,77,78,80,19,81,82,84,85,86,87,88,90,91,92,93,94,95,96,98,99,100
%N Each prime p is followed by p nonprimes.
%C The sequence starts with a(1) = 2 and was always extended with the smallest integer not yet present that does not lead to a contradiction.
%H JeanMarc Falcoz, <a href="/A277376/b277376.txt">Table of n, a(n) for n = 1..7162</a>
%e As a(1) = 2, we take for a(2) and a(3) the nonprimes "1" and "4"; we then extend the sequence with a(4) which must be the smallest prime not yet present: this is "3"; we take for a(5), a(6) and a(7) the 3 smallest nonprimes not yet present: they are 6, 8 and 9; we then extend the sequence with the smallest prime available, which is a(8) = 5. Etc.
%p p:= 0: q:= 0: res:= NULL:
%p for i from 1 to 20 do
%p p:= nextprime(p);
%p res:= res, p;
%p count:= 0;
%p while count < p do
%p q:= q+1;
%p if not isprime(q) then
%p res:= res, q;
%p count:= count+1;
%p fi
%p od
%p od:
%p res; # _Robert Israel_, Oct 19 2016
%K nonn
%O 1,1
%A _Eric Angelini_ and _JeanMarc Falcoz_, Oct 11 2016
