# How many pairs of positive integers are solutions to the equation $5x+7y=1234$

How many pairs of positive integers are solutions to the equation $5x+7y=1234$

My idea was that since $5$ and $7$ are both odd and $1234$ is even then that forces $x$ and $y$ to both be even or both be odd.

Case $1$ if both $x$ and $y$ are even then $5x=1234-7y$ since $x$ is even then $2\leq x \leq 246$ so in case $1$ there are $123$ pairs of solutions.

Case $2$ if both $x$ and $y$ are odd then $5x=1234-7y$ since $x$ is odd then $1\leq x \leq 245$ which again yields $123$ pairs of solutions for a total of $246$ solutions.

• If in case 1 we take $x = 2$, we can rearrange the equation as $7 y = 1224$, but this has no integer solution $y$. – Travis Oct 22 '17 at 22:43
• without cases look at $5 x = 1234 - 7y$. Number $5x$ has 0 or 5 in its numerical record as last digit. So every $y$ which has in its numerous note 2 or 7 as last digit does have its $x$ pair. Others don't. So there are 35 pairs... No? – Lust_For_Love Oct 22 '17 at 22:58

Since $5 \cdot 3 + 7 \cdot (-2) = 1$, it follows that $5 \cdot 3702 + 7 \cdot (-2468) = 1234$. Thus, $x = 3702$, $y = -2468$ is a particular solution to the equation. The theory of linear Diophantine equations gives the general solution $x = 3702 + 7 t$ and $y = -2468 - 5 t$.

Since we want positive solutions, $3702 + 7 t > 0$ and $-2468 - 5 t> 0$. You can check that the integers satisfying these inequalities are $t = -528, -527, \ldots -494$. Thus, there are $35$ positive integer solutions.

How many pair of positive integers are solutions to the equation.
$$5X + 7Y = 1234$$ because $1234$ is even, and only the sum of two odd numbers or two even numbers is even, and also because $5$ and $7$ are both odd.
Therefore $X$ and $Y$ can be both odd or both even; if $X$ was odd, $Y$ would be odd and vice versa.
$X \gt 0$ and $Y \gt 0$
$5X + 7Y = 1234$ $5X = 1234 - 7Y$ $X = \frac{1234}{5} - \frac{7Y}{5}$.
break the fraction $\frac{1235}{5}$ down \begin{align} \frac{1234}{5} = 246 + \frac{4}{5}\\ X = 246 + \frac{4}{5} - \frac{7Y}{5}\\ X = 246 + \frac{4-7Y}{5}\\ X = 246 - \frac{7Y-4}{5}\\ X = 246 - n \end{align}.
Since $X$ is a positive integer, then $\frac{7Y-4}{5}$ must be a positive integer also, and $\frac{7Y-4}{5} = n$.
So that $Y = \frac{5n+4}{7}$ $n$ is a position integer that can make $Y$ a positive integer, as said in the question.
$n = 2, 9, 16, 23, 30.......$ $n = 2 + 7*(a-1)$.
where $n \lt 246$ for $X \rightarrow$ positive, so that by inspection the largest value of $n$ would be $240$.
Put the value of $n$ here $\frac{5n+4}{7}$ to get $Y$.
$Y = 2, 7, 12, 17, ....... , 172$ $Y = 2 + 5*(a-1)$ Maximum $Y$ is Therefore $172$, we can calculate the number of series for $Y$.
$Y_{\text{max}} = 172 = 2 + 5*(a-1)$.
Therefore $a = \frac{172-2}{5} + 1$ so that $a = 35$.
Now work the original equation for $X$ also.
\begin{align} 7Y = 1234 - 5X\\ Y = \frac{1234}{7} - \frac{5X}{7}\\ Y = 176 + \frac{2}{7} - \frac{5X}{7}\\ Y = 176 + \frac{2-5X}{7}\\ Y = 176 - \frac{5X-2}{7}\\ Y = 176 - m \end{align}.
$\frac{5X-2}{7}$ must be a positive integer also $\frac{5X-2}{7} = m$.
where $m \lt 176$ for $Y$ to remain positive.
Insert Possible values for $m$ which would make $Y$ a positive integer. $m = 4, 9, 14, 19, 24........$ $m = 4 + 5*(a-1)$ By inspection, largest value for $m = 174$.
Because $X = \frac{7m+2}{5}$
Then $X = 6, 13, 20, 27,........, 244$ $X = 6 + 7*(a-1)$.
maximum $X = 244$, we can also calculate the number of series for $X$
$X_{\text{max}} = 244 = 6 + 7*(a-1)$ Therefore $a$ also equals $35$
The series for $X$ and $Y$ appear in the equation, such that $X$ increases as $Y$ decreases and vice versa.
\begin{align} X \rightarrow 6,13, 20, 27......., 240, 237, 244\\ Y \rightarrow 172, 167, 162, 157,......,12, 7, 2 \end{align} The number of numbers in the series is $35$, Notice how odd $X$ align for $Y$ and even $X$ align for even $Y$

This is more of a comment as opposed to an answer

$$5x + 7y = 1234$$ What you want to do first is find integer solutions for $x$ and $y$ to satisfy $5x + 7y = 1$. A solution is found by letting $x = 3$ and $y = -2$.

Since $1234 = 1234\times 1$, we just multiply $3$ and $-2$ by $1234$. For example, let $5x + 7y = 2$, then $x = 3\times 2$ and $y = (-2)\times 2$ since $2 = 2\times 1$.

$$\therefore 5x + 7y = \left\{1234 : x = 3\times 1234, \ y = (-2)\times 1234\right\} \Rightarrow x = 3702, \ y = -2468$$

To find other solutions, you can use $5x + 7y = 1$ as a rule to graph the equation and find $x$ and $y$ coordinates. How to do it is to try and get $y$ as the subject (alone on the $LHS$; Left Hand Side of the equation).

$$5x + 7y = 1 \Rightarrow 7y = 1 - 5x \Rightarrow y = -\frac{5}{7}x - \frac{1}{7}$$

Here we see that $-\dfrac{1}{7}$ is the $y$-intercept at $x = 0$ and $-\dfrac{1}{5}$ is the $x$-intercept at $y = 0$.

We can put these four coordinates into ordered pairs $\big(0, -\frac{1}{7}\big), \big(-\frac{1}{7}, 0\big)$ and then plot these coordinates to on the Cartesian Plane to make points. Now we can draw a line through them to make a linear graph (since the line will be straight with a constant gradient) and find points that have integer coordinates. These will be our solutions!

For example, another solution we find is $x = 17$ and $y = -12$. Another solution is $x = 24$ and $y = -17$. Another solution is $x = 31$ and $y = -22$. Do you now see a pattern? $x$ is increasing by $7$ and $y$ is decreasing by $5$. Now multiply these results by $1234$ and you have found other integer solutions!

Also, $x$ and $y$ do not each have to negative, like in all the examples I have given. In fact, $x = -4$ and $y = 3$ is another solution. Or $x = -11$ and $y = 8$. Or $x = -18$ and $y = 13$. The amount of integer solutions are endless!

To formulate, $x = 3\pm 7n$ and $y = -2\mp 7n$ for all positive integers $n \geqslant 0$, that of which take the form $3702\pm 7t$ and $-2468 - 7t$, as mentioned in Bruce Ikenaga’s wonderful answer.