Twisty Multiples of Seven

If n n 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 7 7 are there such that when they are twisted, they are still divisible by 7 7 ?


Note:

Only numbers between 1000 1000 and 9999 9999 inclusive should be counted. Numbers beginning with the digit 0 0 do not count, however numbers that end up with 0 0 as the first digit after being twisted may be counted.

For example, 0273 0273 shouldn't be counted, but 2037 2037 should.


The answer is 168.

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.

1 solution

Leonel Castillo
Jan 27, 2018

Suppose we have a number a b c d abcd (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 + 10 c + d 0 m o d 7 1 0 3 b + 1 0 2 a + 10 d + c 0 m o d 7 10^3 a + 10^2b + 10c + d \equiv 0 \mod 7 \\ 10^3 b + 10^2 a + 10d + c \equiv 0 \mod 7 And as 10 3 m o d 7 10 \equiv 3 \mod 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 6 a + 2b + 3c + d \equiv 0 \mod 7 \\ 6 b + 2a + 3d + c \equiv 0 \mod 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 3a + 5c \equiv 0 \mod 7 \implies c \equiv 5a \mod 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 2b + d \equiv 0 \mod 7 \implies d \equiv 5b \mod 7 . We obtained basically the same result for the numbers c , a c,a and the numbers d , b d,b so here is when I start computation: Find all pairs of digits x , y x,y such that y 5 x m o d 7 y \equiv 5x \mod 7 .


x x 1 2 3 4 5 6 7 8 9 0
y y 5 3 1,8 6 4 2,9 0,7 5 3 0,7

The way this table works is if you choose one x x then choosing any of the y y in the following row (and of the same column) will yield a valid solution. For b , d b,d we have no restrictions and we see there are 14 14 ways of picking values for them. But for a , c a,c we have the restriction that we cannot pick a = 0 a=0 so we can't count the last column. If we ignore the last column we have just 12 12 ways of picking. This gives us a total of 14 × 12 = 168 14 \times 12 = 168 ways of picking.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...