Skip to content
Create a gist now

Instantly share code, notes, and snippets.

import Numeric.Probability.Distribution(T,uniform,decons,norm)
import Data.Maybe(fromJust)
step :: T Rational Integer -> T Rational Integer
step x = norm $ do
cash <- x
if (cash == 0) then
return 0
else do
f <- uniform [flip (-) 1, (*3)]
return (f cash)
result :: [T Rational Integer]
result = iterate step (return 1)
p :: [Rational]
p = map (fromJust . lookup 0 . decons) (tail result)
main =
mapM_ print $ (map fromRational p :: [Double])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.