Van Eck Sequence
Details
The rules of the Van Eck sequence are as follows:
- The first term is zero.
- If the last term is new then the next term is zero.
- Otherwise the next term is how far back the term occurred previously.
The first few terms are as follows:
0 (using a) 0 0 (using b) 0 0 1 (using c) 0 0 1 0 (using b) 0 0 1 0 2 (using c)
Print the first 1,000 terms of the Van Eck sequence, with each term on a new line.
0 bytes, 0 chars
Restore solution
Compiled from
AT&T syntax to x86-64 Linux. Use
syscalls to write output.
ctrl + enter or