# Solve an equation for natural numbered ordered pairs

I want to be able to take a function and find all the ordered pairs where both the $x$ coordinate and $y$ coordinate are natural numbers. I have been working with the equation $$f(x) =\frac{-x^2+45x}{2x+1}$$ which I know has a finite number of natural numbered ordered pairs, ((3,18) and (6,18)) but I have no idea how to find them without using guess and check. Is guess and check the only option or is there a better way to find them?

• Well, you can play with this expression a bit. Easy to see that $\gcd (x,2x+1)=0$ so you want $2x+1$ to divide $45-x$. But if this holds then $2x+1$ divides $90-2x=91-(1+2x)$ so...
– lulu
Jul 18, 2017 at 18:31
• wouldn't the $\operatorname{gcd}(x,2x+1)=1$ Jul 18, 2017 at 19:35

Notice that $-x^2+45 = x(45-x)$. $\gcd(x, 2x+1) = 1$, so $2x+1$ has to divide $45-x$. At this stage, we need a trick. Here, we spot that $2x+1 \mid 45-x$ implies that $2x+1 \mid 2(45-x)$ $= 90 - 2x =$ $91 - (2x+1)$. Hence, $2x+1 \mid 91$.
Now, all you need to do is check the factors of $91 ( = 7 \times 13)$. This yields $x = 0, 3, 6, 45$. However, $x,y$ are natural numbers, so $x = 0$ is invalid; and $x=45$ yields $y=0$, so this case is also invalid. Checking the other two we see that they are valid.
Therefore, $x = 3$ or $6$.
(Note that usually you might have to consider the negative factors of $91$, but here one can clearly see that this would not yield any solutions $\in \mathbb{N}$)