# Magic Square of Squares Competition

#### Art

Joined Sep 10, 2007
806
Hi Math people
Inspired by Matt Parker’s “Parker Square” video, I decided to write my own magic square of squares bruit force program.
I realise it’s highly unlikely to succeed under any circumstance, but it was an experiment.
Obviously for a real bruit force, you wouldn’t bother drawing to screen for starters.

I’m looking for any tips though. I already think it’s probably a silly idea to use uniform distribution pseudo random numbers.
In this case it’s 1-999, but looking at existing squares, maybe, for example,
the number of digits in the roots should be a random number as well.

This video has a glitch that makes it hesitate for a short moment,
but if it finds a solution it will freeze.

ps. I don’t pretend to be a mathematician
Cheers, Art.

#### wayneh

Joined Sep 9, 2010
17,271
I already think it’s probably a silly idea to use uniform distribution pseudo random numbers.
I agree. The problem with drawing samples over and over from a random set is that you have no "memory" of what has been tried and what has not been tried. If you work through methodically, the number of permutations is still enormous but you can eventually say something like, "I've eliminated all permutations where all values are two digits or less." So someone else could start with 3-digit numbers and go forward.

It might be interesting to compute how many possible permutations there are, as a function of the largest number used. How many using 1 digit permutation, how many using up to 2 digit numbers, and so on. Then estimate how much computing power would be needed to evaluate magic squares up to, say, 6 digits. Maybe it's just me but a "magic" square using up to 7 digit numbers doesn't seem all that magical. Rare maybe, but not magic.