Yes, ambrus, in regards to your hidden update, you are correct, but I must give credit to my friend Ton for that. This was one of the first golfs I attempted, and I've been hooked ever since. At the time I really didn't know what I was doing, but Ton's solution is one of the more elegant. You can see several other algorithms at
.