Hello all,

I have a trouble finding Magic Numbers. I'd greatly appreciate any help in writing a function in C/C++ that will find all magic numbers (with 1000 iterations or less).

"Magic numbers" are 6 digit numbers that have the property that they are equal to the square of the sum of two 3-digit numbers when it's high-order and low-order digits are separated.

E.g:

123789 is not a magic number because:

123+789 = 912 and 912^2 = 831744, which is not the original number 123789.

998001 is a magic number because:

998+1 = 999 and 999^2 = 998001, which is the original number.

Thank you very much in advance.

VM