Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Van-Eck-sequence/Dyalect/van-eck-sequence.dyalect
Normal file
14
Task/Van-Eck-sequence/Dyalect/van-eck-sequence.dyalect
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
let max = 1000
|
||||
var a = Array.Empty(max, 0)
|
||||
for n in 0..(max-2) {
|
||||
var m = n - 1
|
||||
while m >= 0 {
|
||||
if a[m] == a[n] {
|
||||
a[n+1] = n - m
|
||||
break
|
||||
}
|
||||
m -= 1
|
||||
}
|
||||
}
|
||||
print("The first ten terms of the Van Eck sequence are: \(a[0..10].ToArray())")
|
||||
print("Terms 991 to 1000 of the sequence are: \(a[991..999].ToArray())")
|
||||
Loading…
Add table
Add a link
Reference in a new issue