## Five-digit Divisibility

#### Problem

Using each of the digits 1, 2, 3, 4, and 5 exactly once to form 5-digit numbers, how many are divisible by 12?

#### Solution

First we note that 12 = 34; in other words, if a number is divisible by 12 it will be divisible by 3 and 4.

For a number to be divisible by 3, the sum of its digits must be divisible by 3: 1 + 2 + 3 + 4 + 5 = 15. As 15 is divisible by 3, ALL 5-digit numbers made up of the digits 1, 2, 3, 4, and 5 will be divisible by 3.

For a number to be divisible by 4, the last two digits must divide by 4.

In our case, the number must end in: 12, 24, 32, or 52.

If the number ends in 12, the first three digits will be 3, 4, and 5, and there are exactly six ways of arranging these numbers: 345, 354, 435, 453, 534, 543.

Similarly, if the number ends in 24, 32, or 52, the first three digits will be 135, 145, and 134 respectively.

As there are six ways of arranging three digits digits: abc, acd, bac, bca, cab, cba, there are 46 = 24 different 5-digit numbers that are divisible by 12.

Investigate the number of `n`-digit numbers, made up of the digits 1 to `n`, that are divisible by 12.

What about being divisible by 15, or 18?

Investigate different divisors.