We can formulate distances to next squares which will be quadratic in nature. For the above number N, it will be,

x^2 + 1287*2*x + (1287^2-N)

(this is the distances to all the higher square to N. Starting with x=0)

x^2 + 2574x + 32 = m^2 ???

So, if the above quadratic expression generates an perfect square (integer). Then N is a composite number. Remember 1*N also comes under a specific squares, so every such equation will definitely have one solution for 1*N factor.

So we need to see if the quadratic expression generates atleast two solution. If yes then definitely N is a composite number.

But I am not able to determine, how to say such a quadratic will generate perfect squares or not.

For the above test number N. Since I know 1656337 is a composite number and 1217 and 1361 are its factor.

In that case, we can find the squares where its distance comes to be a square.
(1217 + 1361) /2 = 1289

So we get from 1289^2, 1217*1361 has descended.

so, 1289^2 - 1656337 = 72^2

i.e

x^2 + 2574x + 32 = 72^2
so we definitely get at x=2 the quadratic is a perfect square

One only need to see if any of the higher squares are square distance to N.

This is much more work than the usual tests if a number is prime.

With a good algorithm, your home computer can check if a 50-digit number is prime in seconds, and find the factors in seconds to minutes. Example script.
4564534346464575453645453857398573985358375558353521
= 132985692076982233761143 * 34323499582363159679580258647 - found in 2 seconds.

With the square numbers, it would have to run for years to millenia. Your approach doesn't look wrong, but it does not help.

With the square numbers, it would have to run for years to millenia. Your approach doesn't look wrong, but it does not help.

x^2 + 2574x + 32 = m^2 ???
Is it really, difficult (or no way), to determine ,if quadratic like above, can generate perfect square or not. I had an impression, it can be solved just like any other equation.

Staff: Mentor

Try the example of 4564534346464575453645453857398573985358375558353521.

It is not sufficient to find any larger square, you have to express the number as difference of two squares. And finding that via trial and error is not feasible - it is equivalent to check all possible factors. Squares are rare if the numbers are that large.

Staff: Mentor

Despite centuries of searches, no one found a method that does not involve a lot of trial and error (for large numbers), or uses the opposite direction (find the primes first, then reconstruct the difference of squares if you are interested in it).
Such a method would revolutionize cryptography. It would also come with a reasonable prize money (that one expired but I think there are follow-up prizes).

It is easy with 4-digit numbers such as yours, because it involves just a few thousand attempts in the worst case. A computer can do that in a millisecond. A computer cannot do 1050 attempts - and that is the range where prime factorization gets interesting.

x^2 + 2574x + 32 = m^2 ???
Is it really, difficult (or no way), to determine ,if quadratic like above, can generate perfect square or not. I had an impression, it can be solved just like any other equation.

Come on, I have solved various questions of this type for you already. We won't keep spoonfeeding you the answer. So you should start by showing us some work.