To unlock his cell phone, Joao slides his finger horizontally or vertically across a numerical box, similar to the one represented in the figure, describing a $7$-digit code, without ever passing through the same digit twice. For example, to indicate the code $1452369$, Joao follows the path indicated in the figure. João forgot his code, but he remembers that it is divisible by $9$. How many codes are there under these conditions?
Problem
Source:
Tags: number theory
15.05.2024 23:33
First column is 1 mod 3, second 2 mod 3 and third, the rightmost one is 0 mod 3 9 – 7 = 2, so we need two adjacent cells with a sum of 0 mod 3, and it can only be of two distinct Nonzero mod 3 or two 0 mod 3s So the excluded would be 1-2, 4-5, 7-8, 3-6 and 6-9 , but if we look at the position of the pairs, only 4-5 has it differently because it only allowed a lane to pass by walling up the middle area Answer = 1 × 2 + (5 – 1) × 2 × (4 – 1) = 1 × 2 + 4 × 2 × 3 = 26
16.05.2024 03:45
Oh, okay wrong answer because I relied on the image too much, it is mod 9 and doesn’t have to be adjacent at all
16.05.2024 03:51
So 9 must be in Joao’s number We can exclude 1-8, 2-7, 3-6 and 4-5 4-5 and 3-6 already covered, so let’s see about 1-8 and 2-7 Okay, so these two are kind of the same Answer = 1 × 2 + 1 × 2 × (4 – 1) + (4 – 2) × 2 = 2 + 6 + 4 = 12