Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Alternating smallest odd/even number not in list followed by that number of consecutive odd/even numbers, sequence commencing with 1.
1

%I #8 May 17 2024 01:28:54

%S 1,3,2,4,6,5,7,9,11,13,15,8,10,12,14,16,18,20,22,24,17,19,21,23,25,27,

%T 29,31,33,35,37,39,41,43,45,47,49,51,26,28,30,32,34,36,38,40,42,44,46,

%U 48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,53,55,57,59,61,63,65

%N Alternating smallest odd/even number not in list followed by that number of consecutive odd/even numbers, sequence commencing with 1.

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

%p R:= NULL: x:= -1: y:= 0: count:= 0: m:= 1:

%p while count < 100 do

%p if m = 1 then

%p R:= R, x+2, seq(x+2*(i+1),i=1..(x+2));

%p count:= count + x+3;

%p x:= R[-1]

%p else

%p R:= R, y+2, seq(y+2*(i+1),i=1..(y+2));

%p count:=count + y+3;

%p y:= R[-1];

%p fi;

%p m:= 1-m;

%p od:

%p R; # _Robert Israel_, May 16 2024

%K nonn,look

%O 1,2

%A _Gerald Hillier_, Oct 18 2009