Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Van-Eck-sequence/Racket/van-eck-sequence.rkt
Normal file
16
Task/Van-Eck-sequence/Racket/van-eck-sequence.rkt
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#lang racket
|
||||
(require racket/stream)
|
||||
|
||||
(define (van-eck)
|
||||
(define (next val n seen)
|
||||
(define val1 (- n (hash-ref seen val n)))
|
||||
(stream-cons val (next val1 (+ n 1) (hash-set seen val n))))
|
||||
(next 0 0 (hash)))
|
||||
|
||||
(define (get m n s)
|
||||
(stream->list
|
||||
(stream-take (stream-tail s m)
|
||||
(- n m))))
|
||||
|
||||
"First 10 terms:" (get 0 10 (van-eck))
|
||||
"Terms 991 to 1000 terms:" (get 990 1000 (van-eck)) ; counting from 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue