Let me know what you think about the new article I posted on medium:
There’s a further tweak you can do. xy is the same as yx so you don’t need to do that twice.
Let’s take an example with max number of 3. Your loops will perform these multiplications:
2x3 // already done
1x3 // already done
1x2 // already done
You can fix that simply by starting the second loop by
Doing so I got 7020 iterations. Sweet!