# Last Digit of Multiplications

I have 4 different 1 digit positive integer numbers $(a,b,c,d)$.

than I apply this formula

$random(a,b,c,d) × random(a,b,c,d) × ... × random(a,b,c,d)$

the last digit of the result is always one of the numbers

What numbers do I have ?

Note :

• $random(a,b,c,d)$ means take 1 random number between a,b,c, or d
• You can do the multiplications as long as you like.
• There are more than 1 solutions
• Are we allowed to use a computer if we wish as an extra answer to be posted later on after giving everyone a chance to try it out for a while? I think there is probably a general rule here. Also, is 0 allowed? That would be a pretty trivial case. – user64742 Oct 14 '16 at 5:01
• @TheGreatDuck : To make sure the answers are complete, you can do that, but I have checked it by computer, and no more answer if 0 is not allowed. There are 7 answers if 0 is allowed. – Jamal Senjaya Oct 14 '16 at 5:39
• The answers if 0 is allowed are : [0,1,4,6], [0,1,5,6], [0,1,5,9], [0,4,5,6], [1,3,7,9], [1,4,6,9], [2,4,6,8] – Jamal Senjaya Oct 14 '16 at 5:41
• oh yeah, you're right. For some reason I thought the inclusion of 0 would make every product = 0. – user64742 Oct 14 '16 at 5:44

Solution 1:

$2,4,6,8$

.

 * | 2 | 4 | 6 | 8
2 | 4 | 8 | 2 | 6
4 | 8 | 6 | 4 | 2
6 | 2 | 4 | 6 | 8
8 | 6 | 2 | 8 | 4


Solution 2:

$1,3,7,9$

.

 * | 1 | 3 | 7 | 9
1 | 1 | 3 | 7 | 9
3 | 3 | 9 | 1 | 7
7 | 7 | 1 | 9 | 3
9 | 9 | 7 | 3 | 1


How about a third solution, in addition to the two provided by Marius and M Oehm:

Solution 3:

$1, 4, 6, 9$

.

 0 | 1 | 4 | 6 | 9
1 | 1 | 4 | 6 | 9
4 | 4 | 6 | 4 | 6
6 | 6 | 4 | 6 | 4
9 | 9 | 6 | 4 | 1


Solution 1:

$2,4,6,8$

Solution 2:

$1,3,7,9$

Other answers have established that there is at least one other solution besides the two intended by the original questioner. Let's determine rigorously what all the solutions are.

If any of the numbers is a 2, then we must also have $2\times2=4$ and similarly 8 and 6. Similarly if any of them is an 8. Therefore, if we have a 2 or an 8 then we have {2,4,6,8}.

If any of the numbers is a 3, then we must also have $3\times3=9$, hence 7, hence 1. Similarly if any of them is a 7. Therefore, if we have a 3 or a 7 then we have {1,3,7,9}.

If neither of those conditions holds then the numbers we have are a subset of {1,4,5,6,9}. It is easy to verify that {1,4,6,9} is a solution. Are there others?

If so, they must contain 5 together with exactly three of {4,6,9}. We can't have both 5 and 4, or both 5 and 6, because then we'd need 0 and the numbers have to be positive. So this isn't possible.

Hence: the possible solutions are in fact exactly the ones already found: {1,3,7,9}, {2,4,6,8}, and {1,4,6,9}. (Odd numbers, even numbers, squares.)

• 6 isn't square, but your point is well taken. :) – Rubio Oct 13 '16 at 17:01
• Rubio, 6 is a square mod 10. Gareth, yes, I could call them +-1 mod 5, but I think the fact that they're the nonzero squares mod 5 is more fundamental. (We basically need "half" the options, which we can get by picking one of the two options mod 2 or by picking the only index-2 subgroup available mod 5.) – Gareth McCaughan Oct 13 '16 at 17:17
• This should be the accepted answer =) – justhalf Oct 14 '16 at 4:23
• @GarethMcCaughan: Btw, {1,4,6,9} is not a set containing only squares (which seems to be implied by your last remark), because 6 is not a square. =) – justhalf Oct 15 '16 at 5:51
• As I said to Rubio, 6 is a square; it's 4 squared. We're working modulo 10 here. – Gareth McCaughan Oct 15 '16 at 15:07

One solution is:

2, 4, 6, 8.

Multiplication of these numbers will always yield an even number, because all numbers are even. It will never yield a number that ends with zero, because none of these numbers has 5 as a prime factor, which is required to get the factor 10.

Marius has already found the second solution:

1, 3, 7, 9.

The reasoning is analogous to the one for the even numbers: Muliplying odd numbers will yield odd numbers. Numbers that end in 5 have a factor of 5, which is coprime to all four numbers.

There are an infinite number of solutions

... if you allow other bases. Below is one solution in base 16.

.

1, 7, 9, f

2,4,6,8 the result will always be pair therefor end in 2,4,6,8

• You should explain this in more detail. – dcfyj Oct 13 '16 at 13:49

Surprised no-one came up with this one yet:

+0 1 5 9

Because:

  * | +0 |  1 |  5 |  9
+0 | +0 | +0 | +0 | +0
1 | +0 |  1 |  5 |  9
5 | +0 |  5 |  5 |  5
9 | +0 |  9 |  5 |  1 

And:

+0 1 4 6

Because:

  * | +0 |  1 |  4 |  6
+0 | +0 | +0 | +0 | +0
1 | +0 |  1 |  4 |  6
4 | +0 |  4 |  6 |  4
6 | +0 |  6 |  4 |  6 

Note:

In response to the (quite correct!) comment that 0 is not positive, I have replaced all occurrences of "0" with "+0", which is a real thing: https://en.wikipedia.org/wiki/Signed_zero - slightly tongue in cheek, but technically correct.

• That would work, except the question says positive integers. – Dan Russell Oct 13 '16 at 21:13
• I'm not surprised at all that no one came up with this solution till now. Because of what DanRussell said. – Marius Oct 13 '16 at 21:41
• Corrected - see note at the end. – AMADANON Inc. Oct 13 '16 at 22:04
• 0 1 5 6 should also work under that premise – hoffmale Oct 14 '16 at 3:58
• I'm not sure this even qualifies as a loophole. It's just a desperate try to turn a wrong answer into a snarky wrong answer. The question clearly states "positive integer numbers". – Marius Oct 14 '16 at 6:45