Find the smallest possible integer $n$ for which $19n+1$ and $95n+1$ are both perfect squares.

I somehow managed to show that $n$ is odd but couldn't find any solution for which both of them are perfect squares.

  • $\begingroup$ Does the text imply that the integer in question be strictly positive? $\endgroup$
    – Lucian
    Mar 19, 2015 at 13:06
  • 1
    $\begingroup$ I ran a C program to find said number but the result was an even number... $\endgroup$
    – Luigi D.
    Mar 19, 2015 at 13:26
  • $\begingroup$ It might be my error but you please post your answer. $\endgroup$
    – Mayank Jha
    Mar 19, 2015 at 13:42
  • 1
    $\begingroup$ Did you try looking at the curve $5x^2-4=y^2$ and lines through the point $(1,1)$ which have rational slope? To get this, let the two squares be $x^2$ and $y^2$ and note that $95=19\cdot 5$. Since $(1,1)$ is a solution with $n=0$, it is on the curve. $\endgroup$ Mar 19, 2015 at 14:29
  • 1
    $\begingroup$ 134232 is the smallest value $\endgroup$
    – ali
    Mar 19, 2015 at 14:41

1 Answer 1



$$95n+1 = x^2$$

$$19n+1= y^2$$

Eliminate $n$ between them and you get the Pell equation,

$$x^2-5y^2 = -4$$

I assume you know how to find all solutions $x,y$. It is then a simple matter to test them such that,

$$n = \frac{x^2-1}{95} = \frac{y^2-1}{19}$$

is an integer. The smallest ones are $n= 134232,\,920040,\,4481374227696,\, 30715795905552,\dots$ ad infinitum. (There doesn't seem to be odd n.)

Equivalently, for $m \ge 0$,

$$n = \frac{F_{18m+17}^2-1}{19} = 134232,\,4481374227696,\dots$$

$$n = \frac{F_{18m+19}^2-1}{19} = 920040,\,30715795905552,\dots$$

where $F_m$ is a Fibonacci number.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.