Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Van-Eck-sequence/Nim/van-eck-sequence.nim
Normal file
12
Task/Van-Eck-sequence/Nim/van-eck-sequence.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
const max = 1000
|
||||
var a: array[max, int]
|
||||
for n in countup(0, max - 2):
|
||||
for m in countdown(n - 1, 0):
|
||||
if a[m] == a[n]:
|
||||
a[n + 1] = n - m
|
||||
break
|
||||
|
||||
echo "The first ten terms of the Van Eck sequence are:"
|
||||
echo a[..9]
|
||||
echo "\nTerms 991 to 1000 of the sequence are:"
|
||||
echo a[990..^1]
|
||||
Loading…
Add table
Add a link
Reference in a new issue