Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Van-Eck-sequence/Python/van-eck-sequence-1.py
Normal file
12
Task/Van-Eck-sequence/Python/van-eck-sequence-1.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
def van_eck():
|
||||
n, seen, val = 0, {}, 0
|
||||
while True:
|
||||
yield val
|
||||
last = {val: n}
|
||||
val = n - seen.get(val, n)
|
||||
seen.update(last)
|
||||
n += 1
|
||||
#%%
|
||||
if __name__ == '__main__':
|
||||
print("Van Eck: first 10 terms: ", list(islice(van_eck(), 10)))
|
||||
print("Van Eck: terms 991 - 1000:", list(islice(van_eck(), 1000))[-10:])
|
||||
Loading…
Add table
Add a link
Reference in a new issue