There are exactly four integers n such that the equation below is an integer. Find the largest n.
\(\frac{(n+1)^2}{n+23}\)
n=1; cycle:a = (n+1)^2 / (n+23);c=if(ceil(a)==floor(a), goto3, goto4);printn,"=",a; n++; if(n<1000, goto cycle, discard=0;
The four numbers are:
n =21, 98, 219, 461
There are exactly four integers n such that the equation below is an integer.
Find the largest \(n\).
\(\dfrac{(n+1)^2}{n+23}\)
\(\begin{array}{|rcll|} \hline \dfrac{(n+1)^2}{n+23} &=& \dfrac{n^2+2n+1}{n+23} \\\\ n^2+2n+1\ :\ n+23 &=& n-21 + \dfrac{484}{n+23} \quad \text{Polynomial long division} \\\\ 484 &=& 0 \pmod{n+23} \quad | \quad \dfrac{484}{n+23} \text{ must be an integer } \\\\ 484-0 &=& m\cdot (n+23), \ m \in \mathbb{Z} \\ 484 &=& m\cdot n +23m \\ m\cdot n &=& 484 - 23m \\ n &=& \dfrac{484 - 23m}{m} \\ n &=& \dfrac{484}{m} - 23 \quad | \quad n \text{ is max, when } m = 1! \\ n_{\text{max}} &=& 484 - 23 \\ \mathbf{ n_{\text{max}} } & \mathbf{=} & \mathbf{ 461 } \\ \hline \end{array}\)