Algebra: Translating a problem into an equation

How would I go about to translate this problem into an equation? I've translated problems in to equations before, but never this kind of problem. I'm quite new to algebra.

You are going to arrange chairs in rows. There should be an equal amount of chairs in each row.

If you arrange the chairs in 5 rows there will be 12 chairs over.

If you arrange the chairs in 7 rows there will be 4 more chairs needed to complete the rows (which you don't have).

How many chairs should it be in every row?

I tried to write it like this: X / 5 = X / 7 + 8 and then I solved for X from there (and found the "answer"), but the equation in question is of course not right to begin with.

Edit:

I'm not looking for the answer or how to solve the equation, just how to translate the problem into an equation. I hope you understand what I mean :)

• $X=5n+12$ and $X=7m-4$. For this, you will get a whole set of answers. Have you heard of modulo before? Commented Oct 19, 2019 at 15:41
• Are the number of columns constant or can they vary? Commented Oct 19, 2019 at 15:42
• @MohammadZuhairKhan Yes I am familiar with it from programming. 7%5=2, right? Commented Oct 19, 2019 at 15:45
• Ok then. We have $X = 12 \pmod 5$ and $X=-4 \pmod 7$. We can simplify this to $X=2 \pmod 5$ and $X= 3 \pmod 7$. Now we have to use the Chinese Remainder theorem: en.wikipedia.org/wiki/Chinese_remainder_theorem Commented Oct 19, 2019 at 15:47

Let the number of chairs in each row be $$n$$ and the total number of chairs be $$N.$$ Then from the third sentence we have that $$N$$ has been partitioned as $$5n+12.$$ Thus we have $$N=5n+12.$$ Similarly, from the next statement we have that $$N=7n-4.$$
Thus we deduce the equation $$5n+12=7n-4,$$ which we want to solve for $$n.$$