I was introduced to it in a book named "Group Theory in the Bedroom, and Other Mathematical Diversions" by Brian Hayes. The author actually did write code to solve this problem. I can assure you it's been done.
@feersum Hmm. Let's say that task A is to do n = n*n % m10,000 times, given a seed of n=1 and m=395891 (a prime number) and that task B is to do the actual challenge. Let's further say that Python takes 1 second to do task A and the given solution takes 10 seconds to do task B whereas C takes 0.1 seconds to do task A and the given solution takes 5 seconds to do task B. Then Python's ratio is 10/1 = 10 and C's ratio is 5/0.1 = 50. Clearly, Python has the superior algorithm here.
Your objection, as I understand it, is that if the metric were something else, we would have different ratios. I don't think that's a problem because Python should still beat C relatively.
"When I finally got a chance to write a program for this process, I found that the algorithm is exquisitely sensitive to the order of operations. Consider the situation just as the Pacific is about to reach the lowest point on the divide. If the Atlantic has not been raised in synchrony, then the Pacific waters will pour over the saddle point and flood part of the eastern basin, shifting the divide to an incorrect position. "
@feersum Yes, you used a faster language. Python would never be able to win a fastest-code challenge if anyone posts with a faster language, like C, which is a great choice because it's so fast. I'm trying to figure out a way to compare languages fairly.
@feersum Didn't yours calculate all (n*m)! permutations?
> Number of MxN grids where 1<N<=M, all entries are distinct, all entries are at least 0 and at most M*N-1, and every 2x2 block of entries has the same sum.
A guy made a fake proof that switching doors in the Monty Hall problem gives a 50% chance of winning and it took me around 20 minutes to figure out why it was wrong.
1. Take n doors, with one prize 2. Pick one door 3. Remove n-2 doors wit no prize 4. Switching doors gives you (n-1)/n chance to win 5. Sticking with the one you chose gives you 1/n chance to win
@Lembik I once implemented it when I hadn't yet understood the proof. I then still didn't understand the proof, but believed in it a bit more.
@Lembik For your question, making the FPS range from 30fps up would be a good definition of "smooth". It should also have no visible flicker, so that's good enough.
I don't fully understand the use of fps here as I require that the sprite is shown at every position and I say how long it has to take to cross the screen