The sequences in The On-Line Encyclopedia of Integer Sequences® are themselves arranged into a sequence, each being indexed by Axxxxxx. Hence, the sequence

`2, 3, 2, 1, 3, 4, 1, 7, 7, 5, 45, 2, 181, 43, 17, ... `

can never be included in the encyclopedia: its definition is .

By the way, which sequences have the honor of being on the virtual first page of the OEIS? A000004 consists of zeros. Its description offers the following explicit formula:

a(n)=A*sin(n*Pi) for any A. [From Jaume Oliver Lafont, Apr 02 2010]

The sequence A000001 counts the groups of order n.

The sequence A000002 consists of 1s and 2s only:

`1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, ... `

The defining property of this sequence is self-similarity: consider the runs of equal numbers

`1, 22, 11, 2, 1, 22, 1, 22, 11, 2, 11, 22, 1, 2, 11, 2, 1, 22, 11, ... `

and replace each run by its length:

`1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, ... `

You get the original sequence again.

This is the Kolakoski sequence, which first appeared in print in 1965. Contrary to what one might expect from such a simple definition, there is no simple pattern; it is not even known whether 1s and 2s appear with the same asymptotic frequency 1/2. One way to look for patterns in a function/sequence is to take its Fourier transform, and this is what I did below:

Specifically, this is the absolute value of . To better see where the peaks fall, it’s convenient to look at :

Something is going on at , i.e. at period 3. Recall that the sequence contains no triples 111 or 222: there are no runs of more than 2 equal numbers. So perhaps it’s not surprising that a pattern emerges at period 3. And indeed, even though the percentage of 1s among the first 500 terms of the sequence is 49.8%, breaking it down by n mod 3 yields the following:

- Among , the percentage of 1s is 17.4%
- Among , the percentage of 1s is 85.2%
- Among , the percentage of 1s is 46.8%

Noticing another peak at , I also broke down the percentages by n mod 9:

- : there are 5.4% 1s
- : there are 74.8% 1s
- : there are 41.4% 1s
- : there are 21.6% 1s
- : there are 97.2% 1s
- : there are 70.2% 1s
- : there are 25.2% 1s
- : there are 84.6% 1s
- : there are 28.8% 1s

Nothing close to 50%…

In conclusion, my code for the Kolakoski sequence. This time I used Maple (instead of Scilab) for no particular reason.

`N:=500; ks:=Array(1..N+2); i:=0; j:=1; new:=1;`

while i<=N do i:=i+1; ks[i]:=new;

if (ks[j]=2) then i:=i+1; ks[i]:=new; end if;

j:=j+1; new:=3-new;

end do: