If is a positive integer with an even number of digits, I can twist it by swapping around pairs of digits like this:
How many 4 digit numbers divisible by are there such that when they are twisted, they are still divisible by ?
Note:
Only numbers between and inclusive should be counted. Numbers beginning with the digit do not count, however numbers that end up with as the first digit after being twisted may be counted.
For example, shouldn't be counted, but should.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Suppose we have a number a b c d (concatenated digits) that has the property given in the problem. Then we can assume this number obeys the two following congruences: 1 0 3 a + 1 0 2 b + 1 0 c + d ≡ 0 m o d 7 1 0 3 b + 1 0 2 a + 1 0 d + c ≡ 0 m o d 7 And as 1 0 ≡ 3 m o d 7 we may simplify these into: 6 a + 2 b + 3 c + d ≡ 0 m o d 7 6 b + 2 a + 3 d + c ≡ 0 m o d 7 .
Add twice the second congruence to the first to get 3 a + 5 c ≡ 0 m o d 7 ⟹ c ≡ 5 a m o d 7 . Now plug this result into either of the previous congruences to get 2 b + d ≡ 0 m o d 7 ⟹ d ≡ 5 b m o d 7 . We obtained basically the same result for the numbers c , a and the numbers d , b so here is when I start computation: Find all pairs of digits x , y such that y ≡ 5 x m o d 7 .
The way this table works is if you choose one x then choosing any of the y in the following row (and of the same column) will yield a valid solution. For b , d we have no restrictions and we see there are 1 4 ways of picking values for them. But for a , c we have the restriction that we cannot pick a = 0 so we can't count the last column. If we ignore the last column we have just 1 2 ways of picking. This gives us a total of 1 4 × 1 2 = 1 6 8 ways of picking.