OFFSET
1,2
COMMENTS
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.
EXAMPLE
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
(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
(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
> 1/3, hence a(11) = 3.
PROG
(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)}
CROSSREFS
KEYWORD
nonn
AUTHOR
Klaus Brockhaus, Mar 21 2005
STATUS
approved