Saturday, September 03, 2011

When will the 1000th XKCD will come out? F# knows (as in using F# to figure it out...)

Robert Pickering's Strange Blog - Calculating when the 1000th XKCD will appear

"Like so many geeks I’m a massive XKCD fan. But I’m often troubled by questions like when will the 1000th XKCD appear, or the 1024th or even the 2000th? Even though the first two numbers are getting quite close now, it’s still more fingers and toes than I have so working it out by hand is out. Fortunately we have computers to this kind of heavy lifting for us, and the solution in F# is kinda cute.

We need 3 pieces of information to be able to work out when any given XKCD will appear: an epoch date and number as well as the days that XKCD is published on. I chose todays date, 2nd September 2011 when XKCD 946 was published. I would have been nice to start with issue 1, but in the early days of XKCD it wasn’t published regularly so starting at the beginning would considerable complexity the task, and besides, we already know when numbers in the past were published. XKCD is published on Mondays, Wednesdays and Fridays, so here’s how we encode this information in F#:

...

image..."

There's something that's just dev-geek awesome about this...

No comments:

Post a Comment

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...