Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Executable-library/Racket/executable-library-2.rkt
Normal file
12
Task/Executable-library/Racket/executable-library-2.rkt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#lang racket
|
||||
(require "hs.rkt")
|
||||
(define N 100000)
|
||||
(define t (make-hasheq))
|
||||
(define best
|
||||
(for/fold ([best #f]) ([i (in-range 1 (add1 N))])
|
||||
(define len (length (hailstone i)))
|
||||
(define freq (add1 (hash-ref t len 0)))
|
||||
(hash-set! t len freq)
|
||||
(if (and best (> (car best) freq)) best (cons freq len))))
|
||||
(printf "Most frequent sequence length for x<=~s: ~s, appearing ~s times\n" N
|
||||
(cdr best) (car best))
|
||||
Loading…
Add table
Add a link
Reference in a new issue