June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
13
Task/Executable-library/Clojure/executable-library-2.clj
Normal file
13
Task/Executable-library/Clojure/executable-library-2.clj
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(ns rosetta-code.frequent-hailstone-lengths
|
||||
(:require [rosetta-code.hailstone-sequence
|
||||
:refer [hailstone-seq]]))
|
||||
|
||||
(defn -main [& args]
|
||||
(let [frequencies (apply merge-with +
|
||||
(for [x (range 1 100000)]
|
||||
{(count (hailstone-seq x)) 1}))
|
||||
[most-frequent-length frequency]
|
||||
(apply max-key val (seq frequencies))]
|
||||
(printf (str "The most frequent Hailstone sequence length for numbers under 100000 is %s,"
|
||||
" with a frequency of %s.\n")
|
||||
most-frequent-length frequency)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue