A solution to a fabled problem

We’ve all heard the story in school — when chess was invented in India the local King (they had lots of kings back then apparently) was so impressed by the game that he offered its creator whatever he wanted. The man (who was rumored to be wise but somewhat of a smart-ass) responded that all he wanted were a few grains of rice. The number of grains was to be determined as follows: using a chessboard, place 1 grain on the first square, two on the second, four on the third, 8 on the fourth, etc. To which the King immediately assented, until one of his ministers told him that not only was this more than he had to give, but was in fact more grain that was produced by the entire known world at the time.

So, being somewhat of a smart-ass myself and being in the middle of learning the python programming language I figured I’d come up with a neat and efficient way to calculate exactly what that number was. It’s not that difficult. Basically because the chessboard has 64 squares, the number you’re looking for is the sum of the solutions for 20 through 263.

Since Python is loosely-typed you don’t have to worry about declaring the right type of integer to hold the final result, which is astronomically big. Here’s the code for it:

numTotal = 0;
for numExponent in range (0,64):
    numTotal += 2**numExponent
    print "Total at", numExponent, ": ",numTotal
print "All done."

Note: even though I declared the range 0 to 64, 64 is not itself included.

So what’s the final result? It’s 18446744073709551615. 18 quintillion, 445 quadrillion, 744 trillion, 73 billion, 709 million, 551 thousand and 615. Quite a large number indeed and assuredly more than the King could deliver.

An open letter to a Montreal cyclist

To the Chinese man on a bike who nearly plowed into my car this morning: what the fuck is wrong with you?

Seriously, I was waiting at a red light for at least 30 second with my turn indicator on. Meanwhile you were riding next to the sidewalk, hidden from my view by a number of large roadworks cones. You did not stop. You did not slow down. In fact if it weren’t for the fact that I, yes I, was paying attention to my blind spot when I turned in, you would have been seriously hurt. Especially since you weren’t wearing a helmet. I suspect that’s because you don’t have much to protect up there.

And then you had the balls to yell at me, you dumbass inbred motherfucker. I flipped you the bird and honked my horn at you because frankly I did not feel it would have been appropriate for me to turn off my engine, get out of my car, and give you the shit-kicking that you absolutely and definitely deserved. I was in the middle of the road and had a job to get to, you stupid cunt.

Watch where the fuck you’re going you moron. I hope you burn a red light and get hit by a semi or a bus. Why that choice of vehicle? Because either of those can run you over and not be overly damaged or cause another accident as a result. You are a fucking menace to everyone on the road and the sooner you are forced off it the better off this city will be.

Videos

As a result of a heavy-handed, false and borderline-libelous copyright enforcement action against me by Youtube earlier today I have removed all my videos from that site. I will also no longer be posting any links to videos hosted there and, if I have time and can be bothered, might also go ahead and delete any such links on this site.

Sweetening the pot

Disappointingly I still have no takers for my offer to take over property owned by people who genuinely think that the world will end on Saturday, so let me sweeten the pot a little bit on this — I will give you $20 right now if you will turn your property over to me Saturday at 11:59 pm (EDT). This is a very good deal, because if you truly think that, according to the Bible, the world will end Saturday you will still get the $20 and I will get nothing. So you should all think about it, doomsday people! if, of course, your faith is strong and unwavering. On the other hand, you want to “play it safe” and hold on to your stuff “just in case”, then you really have no faith, have you?