# Finding positive integer solutions to functions with only positive integer input

For the equation

$f(x,y) = x^2/y$

given that $x$ and $y$ are integers

What is the easiest/fastest way to find at least one tuple $(x_0,y_0)$ solution to $f(x,y)=4$ or any other number really. I know that $(2,1)$ would work, but is there a process for finding the solution to any integer that is equal to $f(x,y)$?

Is there any easy way to just enter this in and calculate it in Mathematica, MATLAB, Sage, etc.? Is there any way to work this out by hand besides just guessing which values would work?

-

This could help: $x^2/y=a$, where $x,y,a$ are integers. If $a$ is a perfect square, $y=1$ and $x=\sqrt{a}$. If it isn't a perfect square, suppose $a=p_1^{\alpha_1}...p_k^{\alpha_k}$. Then any $y$ of the form $p_1^{\beta_1}...p_k^{\beta_k}$ such that $\alpha_i +\beta_i$ is even will do, because then $ay$ will be a perfect square. Moreover, $ay$ times any other perfect square is good too.

-

One obvious solution to f(x,y)=a is x=y=a, since a^2/a = a.

-
• Mathematica is great. Mathematica is a crutch. If you depend on a calculator, you won't get the meaning of your answer and you won't know what to do with it.

• If you know nothing about the RHS, to get a 'minimal' answer by generate and test, go in rings around the origin:

{0,0}

{1,0},{0,1},{-1,0},{0,-1}

{2,0},{1,1},{0,2},{-1,1},{-2,0},{-1,-1},{0,-2},{1,-1}

... (is that how Mathematics's FindInstance works?)

• If the RHS is $x^2/y$, to understand the problem, what is the thing that causes immediate problems with integers (getting integer solutions)? It's the division. If $x$ divides $y^2$ (in order to make f an integer) $x$ has to divide $y$. That is, beyond yrudoy's answer, you can make $x$ be any divisor of $y$.

-