Van Eck sequence: Difference between revisions

Fix, and change to less ambiguous letters.
(New draft task with python examples.)
 
(Fix, and change to less ambiguous letters.)
Line 2:
The sequence is generated by following this pseudo-code:
<pre>
1A: The first term is zero.
Repeatedly apply:
If the last term is *new* to the sequence so far then:
2B: The next term is zero.
Otherwise:
3C: The next term is how far back this last term occured previousely.
</pre>
 
 
;Example:
Using 1A:
:<code>0</code>
Using 2B:
:<code>0 0</code>
Using 3C:
:<code>0 0 1</code>
Using 2B:
:<code>0 0 1 0</code>
Using 3C: (zero last occured two steps back - before the one)
:<code>0 0 1 0 2</code>
Using 1B:
:<code>0 0 1 0 2 0</code>
Using 3C: (two last occured two steps back - before the zero)
:<code>0 0 1 0 2 0 2 2</code>
Using 3C: (two last occured one step back)
:<code>0 0 1 0 2 0 2 2 1</code>
Using 3C: (one last appeared six steps back)
:<code>0 0 1 0 2 0 2 2 1 6</code>
...
Anonymous user