%I #2 Mar 30 2012 17:27:47
%S 1,3,1,3,1,3,1,3,2,6,3,9,4,12,6,18,9,27,14,42,21,63,31,93,47,141,70,
%T 210,105,315,158,474,237,711,355,1065,533,1599,799,2397,1199,3597,
%U 1798,5394,2697,8091,4046,12138,6069,18207,9103,27309,13655,40965,20482,61446
%N a(1) = 1; for n > 1: if n is even, a(n) = least k > 0 such that sum(i=1,n/2,a(2*i-1))/sum(j=1,n,a(j))>=1/4, or 1 if there is no such k; if n is odd, a(n) = largest k > 0 such that sum(i=1,(n+1)/2,a(2*i-1))/sum(j=1,n,a(j))<=1/3, or 1 if there is no such k.
%C If this sequence is interpreted as describing a 0-1-sequence: a(1) 1's followed by a(2) 0's followed by a(3) 1's ... (alternatingly), then the portion of 1's in that 0-1-sequence oscillates between 1/4 and 1/3, except for a slight disturbance at the beginning. Quite analogously, sequences can be constructed that describe 0-1-sequences where the portion of 1's oscillates between arbitrary bounds 0 < r < s < 1. However, depending on the choice of the bounds, the initial disturbance may extend rather far.
%C Interleaving of A073941 and A081848 from a(3) onward.
%e Consider n = 10; for k = 5 we have (1+1+1+1+2)/(1+3+1+3+1+3+1+3+2+k) = 6/23 < 1/4, but for k = 6 we have
%e (1+1+1+1+2)/(1+3+1+3+1+3+1+3+2+k) = 6/24 >= 1/4, hence a(10) = 6. Consider n = 11; for k = 3 we have
%e (1+1+1+1+2+k)/(1+3+1+3+1+3+1+3+2+6+k) = 9/27 <= 1/3, but for k = 4 we have (1+1+1+1+2+k)/(1+3+1+3+1+3+1+3+2+6+k) = 10/28
%e > 1/3, hence a(11) = 3.
%o (PARI) {print1(a=1,",");p=1;s=1;for(n=1,28,k=1;while(((p)/(s+k))>=(1/4),k++);print1(a=max(1,k-1),",");s=s+a;k=1;while(((p+k)/(s+k))<=(1/3),k++);print1(a=max(1,k-1),",");s=s+a;p=p+a)}
%Y Cf. A073941, A081848.
%K nonn
%O 1,2
%A _Klaus Brockhaus_, Mar 21 2005