# Permuations and digits

1. How many six digit positive integers comprising only the digits 1 and 2 exist such that the number is divisible by 3?

For a number to be divisible by 3, the sum of the digits must be divisible by 3.
Case 1: 111111: This can rearrange in only one way.
Case 2: 222222: This can rearrange in only one way.
Case 3: 111222: This can rearrange in 6!/(3! *3!) = 20 ways

The total number of ways = 1 + 1 + 20 = 22.

2. How many five digit positive integers comprising only the digits 1, 2, 3, and 4, each appearing at least once, exist such that the number is divisible by 4?

For a number to be divisible by 4, the last two digits need to be divisible by 4. The last two digits can be 12, 24, 32, and 44.

Case 1: Ending with 12:
(a) The first three digits can be 2, 3, and 4. This can rearrange in 3! = 6 ways
(b) The first three digits can be 1, 3, and 4. This can rearrange in 3! = 6 ways
(c) The first three digits can be 3, 3, and 4. This can rearrange in 3!/2! = 3 ways
(d) The first three digits can be 3, 4, and 4. This can rearrange in 3!/2! = 3 ways
Total = 18 ways.

Case 2: Ending in 24: similar to case 1: 18 ways

Case 3: Ending in 32: Similar to case 1: 18 ways

Case 4: Ending in 44:
The first 3 digits are 1, 2, and 3. This can rearrange in 3! = 6 ways.

TOTAL: = 18 + 18 + 18 + 6 = 60 ways.