# Finding 3 variables a,b,c. 31a+30b+28c=365

well, I have this question: Find positive integers $a,b,c$ that solve $$31a+30b+28c=365.$$

Well, it was easy to find them, since i noticed that it actually asks for the months in a year. As, how many months have 31 day each? Which is $a$, and how many have 30? Which is $b$, and $c$ is the ones with 28. It turns to be that $a=7, b=4$, and $c=1$.

My question is that if there's any mathematical way to do it, rather than counting months.

Also, for ANY $a,b,c$ (positive integer) that the statement ($31a+30b+28c=365$) is correct, prove that $$a+b+c=12$$ must be correct.

How can i do it? (Not just adding $7+4+1=12$; it must be generalized)

Thank you!

• Find one solution $(7,4,1)$ isn't find all solutions $(a,b,c)$ to your equation. What do you want exactly? – FDP Jan 17 '15 at 17:37
• This can help you: math.stackexchange.com/questions/514105/… – Alex Silva Jan 17 '15 at 17:43

To show that in any solution the sum $a+b+c$ must equal $12$:

Write $31a+30b+28c=28(a+b+c)+3a+2b$.

If $a+b+c>12$, then $28(a+b+c)+3a+2b\ge28\cdot 13+3a+2b=364+3a+2b$. So with positive integer values of $a,b,c$ the sum will exceed $365$ if $a+b+c$ exceeds $12$.

If $a+b+c<12$, then $31a+30b+28c \le 31\cdot 11=341$. Too small.

• In the first case, don't you mean $28(a+b+c)+3a+2b\ge 28\cdot 13+3a+2b=364+3a+2b$? And in the second case, do you mean $31a+30b+28c\le 31a+31b+31c=31(a+b+c)\le 31\cdot 11=341$? – Rory Daulton Jan 17 '15 at 19:36
• @RoryDaulton: Thanks, quite right about case 1--and I edited in your correction. Case 2 I think we're saying the same thing. – paw88789 Jan 17 '15 at 19:43
• You are right about case two, but your answer seemed too terse for me. It took me a while to understand your thought process. My comment was intended to recommend that you expand your explanation of case two to make it more clear. Anyway, I liked your answer enough to upvote it. – Rory Daulton Jan 17 '15 at 19:50

I think the best strategy is to find the maximum value of one of the variables, say $a$. This is a convenient choice because we know it must be odd, as we're summing $31a$ (odd iff $a$ is odd) to $2(15b+14c)$ (even) and getting $365$ (odd). Also, it is obvious that for $a\ge11$ there are no solutions. Letting $a=9$ we have $$15b+14c=43,$$ and we immediately recognize $b=1$ and $c=2$. The "canonical" answer can be found similarly. $a=7$ yields $$15b+14c=74,$$ which needs $c=1$ to be satisfied, since we have $4$ as the last digit of the sum, and it is easy to see the only ways are $b=2n$ and $c=1+4n$, and that $c=5$ is not acceptable. Then $b=4$ is evident. The same reasoning gives $(5,7,0)$, if you accept non-negative integers, and throws away $a=1,3$. To sum up, the non-negative integer solutions are $(5,7,0),$ $(7,4,1)$ and $(9,1,2).$ You can observe the sum is always $12$, otherwise see paw's answer.

Solving this over the rational numbers is much easier: you can pick any values for $b$ and $c$, then set

$$a = \frac{365 - 28c - 30b}{31}$$

and get a solution. Furthermore, all rational solutions are of this form.

Every integer solution is a rational solution; so we can simplify the original problem to

For which integers $b,c$ is $365 - 28c - 30b$ a multiple of $31$?

or more usefully,

Solve $30b + 28c \equiv 365 \pmod{31}$

so we can solve the problem by doing algebra modulo 31. This particular problem is especially easy to solve, via

\begin{align} 30b &+ 28c \equiv 365 \pmod{31} \\-b &+ 7c \equiv 24 \pmod{31} \\ &b \equiv 7c - 24 \equiv 7c + 7 \pmod{31} \end{align}

and so we can write down the complete solution as:

• Choose any integer for $c$
• Choose any integer $k$ and set $b = 7c + 7 + 31k$
• Set $a = (365 - 28c - 30b)/31$

Now that we know how to solve this over the integers, it only takes a little bit of work to find all of the solutions among the positive integers.

• Hurkyl:a little bit of work really? – FDP Jan 17 '15 at 21:51

Since $31a+30b+28c=365$ and $a,b,c$ are positive integers then:

Roughly:

$a\leq \dfrac{365}{31}$ i.e $0 \leq a \leq 11$

$b\leq\dfrac{365}{30}$ i.e $0 \leq b \leq 12$

A program can easily find the solutions:

$(5,7,0);(9,1,2);(7,4,1)$

Notice that all solutions are such that: $a+b+c=12$

NB: Since $31a=365-2(15b+14c)$ and $31$ is odd then $a$ is odd.

PS: A complete solution without computer:

since $0\leq a\leq 11$ is odd, $a$ belongs to $\{1,3,5,7,9,11\}$

The solutions of the equation $15x+14y=t$ ,with $t>0,x,y$ integers, are $(t+14k,-t-15k)$,$k$ integer.

$t+14k$ and $-t-15k$ are positive integers if only if $k \in \Big[-\dfrac{t}{14};-\dfrac{t}{15}\Big]$

if $a=1$ then $(b,c)$ are solutions of $167=15x+14y$ but there is no integer in $\Big[-\dfrac{167}{14};-\dfrac{167}{15}\Big]$

if $a=3$ then $(b,c)$ are solutions of $136=15x+14y$ but there is no integer in $\Big[-\dfrac{136}{14};-\dfrac{136}{15}\Big]$

if $a=5$ then $(b,c)$ are solutions of $105=15x+14y$ but there is only one integer in $\Big[-\dfrac{105}{14};-\dfrac{105}{15}\Big]$, $-7$.

Therefore $(a,b,c)=(5,7,0)$

if $a=7$ then $(b,c)$ are solutions of $74=15x+14y$ but there is only one integer in $\Big[-\dfrac{74}{14};-\dfrac{74}{15}\Big]$, $-5$.

Therefore $(a,b,c)=(7,4,1)$

if $a=9$ then $(b,c)$ are solutions of $43=15x+14y$ but there is only one integer in $\Big[-\dfrac{43}{14};-\dfrac{43}{15}\Big]$, $-3$.

Therefore $(a,b,c)=(9,1,2)$

if $a=11$ then $(b,c)$ are solutions of $12=15x+14y$ but there is no integer in $\Big[-\dfrac{12}{14};-\dfrac{12}{15}\Big]$

• There's no need of a program. – Vincenzo Oliva Jan 17 '15 at 19:04