sterns = map (stern' 0) [0..]
where
stern' :: Int -> Int -> Int
stern' acc 0 = acc
stern' acc 1 = stern' (acc + 1) 0
stern' acc n
| even n = stern' acc (n `quot` 2)
| otherwise = let
m = n-1
in stern' (acc + stern' 0 ((m `quot` 2) + 1)) (m `quot` 2)