I added a lot of comments. Hopefully that will help with a C translation. I just noticed you are starting with odds whereas I am filtering them out at cost of extra CPU time. I'll update my version tonight to do that also.
I'm still quite in awe of the Haskell version. It is quite expressive while performing the same. I don't understand all the specific functions or operators, but I "get" it in a general sense. Whereas I had to remove any semblance of human thought to run mine faster.
Turned out starting with odds didn't change the runtime at all really. But it led me to some shorter code that accomplished the same thing.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.