Artificial intelligent assistant

Fundamental Solution for This Number Theory Problem. "In a military parade, the General ordered the soldiers to make square formations. They did so and 13 squares with exactly the same number of soldiers in each one were made. When the General joined the parade, it was possible to create one huge square. How many soldiers must there have been in this parade?" I've been trying to solve this problem manually using the equation $ 13y^2 + 1 = x^2 $ (y being the number of people in each square and x being the square root of the solution) and a calculator, but the answer still eludes me. Is there a fundamental way of solving this problem? (It was in the Linear-Inequalities section of a textbook).

**Hint:**

$$13y=x^2-1=(x-1)(x+1).$$ Since $13$ is a prime, therefore $13$ divides one of $x-1$ or $x+1$. But $\gcd(x+1,x-1) \leq 2$, therefore $13$ can divide exactly one of them at a time. Now proceed further.

**Addendum**

As Robert Israel mentioned in his comments, I hope you are aware of the fact that $y$ has to be a square (because based on your notation $y$ is the number of soldiers in a square formation). So let $y=z^2$, then the proper way to do this problem would be to look for solutions of $$x^2-13z^2=1.$$

This is a Pell's equation.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 069784d99206938e7239dd47150c54ae