3 ms·
Had to try it! (Clojure) (frequencies (take 100 (map #(first (str (first %))) (iterate (fn [[x y]] [y (+' x y)]) [0 1]))))
by markc 9y ago
Had to try it! (Clojure)
(frequencies
(take 100
(map #(first (str (first %)))
(iterate (fn [[x y]] [y (+' x y)]) [0 1]))))
=> {\0 1, \1 30, \2 18, \3 12, \4 9, \5 8, \6 6, \7 5, \8 7, \9 4}
i.e. Yup, Fibonacci up to 100, 30% start with 1, 18% start with 2.