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.

A104740 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.

Original entry on oeis.org

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, 210, 105, 315, 158, 474, 237, 711, 355, 1065, 533, 1599, 799, 2397, 1199, 3597, 1798, 5394, 2697, 8091, 4046, 12138, 6069, 18207, 9103, 27309, 13655, 40965, 20482, 61446
Offset: 1

Views

Author

Klaus Brockhaus, Mar 21 2005

Keywords

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.
Interleaving of A073941 and A081848 from a(3) onward.

Examples

			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.
		

Crossrefs

Programs

  • 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)}