# how many ways of arranging given 7 two digit positive integers so that the sum of every four consecutive integer is divisible by 3?

in how many ways can I arrange the numbers: 21,31,41,51,61,71,81 such that the sum of every four consecutive numbers is divisible by three?

Though I am not an expert on modulo math, I do know that if we were to take MOD 3 on all of the numbers in the list, I would get the following in respective order:

$0_{21}, 1_{31}, 2_{41}, 0_{51}, 1_{61}, 2_{71}, 0_{81}$ (the subscript correlates to what original number it represents) and clearly if we were to match the values so that the sum is a multiple of three, the numbers added up would also be a multiple of three.

But upon realizing that the numbers must be consecutive and that if taking any four consecutive numbers in a set of 7 terms, I got stuck here and do not know how to proceed.

• Could you give an example of what you're looking for? There are some ambiguities in your question (specifically, do you mean digits or numbers?) – Michael Burr May 19 '17 at 12:01
• The OP explicitly talks about concecutive "numbers", and also his (good) start points in that direction. – drhab May 19 '17 at 12:05
• There is no ambiguity. The question asks about arranging the numbers $21,...,81$ with every four consecutive numbers having some property. There is no mention of digits. – Especially Lime May 19 '17 at 12:07

If you want the sums $a_1+a_2+a_3+a_4$ and $a_2+a_3+a_4+a_5$ to both be multiples of $3$, then you must have $a_1\equiv a_5$ mod $3$. Similarly $a_2\equiv a_6$, $a_3\equiv a_7$.

This means that you need to pair these numbers off in pairs which are equal mod $3$, and the other one, $a_4$, must be $0$ mod $3$ (because there are three numbers which are $0$ mod $3$).

So your sequence, mod $3$, must be one of the following:

• $0,1,2,0,0,1,2$
• $0,2,1,0,0,2,1$
• $1,0,2,0,1,0,2$
• $1,2,0,0,1,2,0$
• $2,0,1,0,2,0,1$
• $2,1,0,0,2,1,0$.

All of these work. Once you've chosen one of these sequences you can fill it in by replacing the $0$s with $21,51,81$ in some order, the $1$s with $31,61$ in some order, and the $2$s with $41,71$ in some order. There are therefore $6\times6\times2\times2=144$ ways to do this in total.

• why is it 6x6x2x2? I understand all of the potential sequences that you have laid out but i don't understand the miltoplication – John Rawls May 23 '17 at 15:45
• The first $6$ is the six different sequences of $0$s, $1$s and $2$s. The second $6$ is $3!$ for the number of different orders $21,51,81$ can go in (they have to go in the three $0$ places, but you can put them in those places in any order). Then there are $2$ ways to put in $31$ and $61$ (either $31$ goes in the first $1$ place and $61$ goes in the second, or vice versa), and similarly there are $2$ ways to put in $41$ and $71$ in the two $2$ places. Since all of these are independent choices you multiply them together. – Especially Lime May 23 '17 at 21:44