Gratz to the winner and thanks for the explanation.
Why do you take 5000000000 iterations? I cant verify it using the tool (my browser freezes). Why not just one iteration? Or 10? Or 5.000? Why so many?
Thank you!
Basically the only point of this step is to waste time.
The attack it's designed to prevent, is if a bitcoin miner bought lots of tickets in the lottery, when they solved a bitcoin block they could check to see if they won the lottery or not. If they didn't win the lottery, what they could do is throw away that block (and its 25+ btc of rewards) and never mine it. Which would effectively give them a 2nd chance at winning.
So what we do, is make the check take a long time. Like an hour-long. So the hypothetical miner, if they found a xxx006 block would have to spend an hour to check if they won the lottery. During this hour they have a MASSIVE risk of having their block orphaned (even a large pool, even if they were burning money privately mining on top of it) so the economics become pretty infeasible.