by donovanbiela · 9y ago · 0 comments
(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.But a quick calculation makes it look like powers of two don't satisfy Benford's law, For example the first power of 2 which begins with 7 is 2^46, and the first power of 2 which begins with 9 is 2^53. This takes so long, roughly speaking, because 2^10 = 1024 is so close to a power of ten.