H2. How many nine-digit integers of the form 'pqrpqrpqr' are multiples of 24 ? (Note that $p, q$ and $r$ need not be different.)
Solution 1
In order to be a multiple of 24 , any number must be both a multiple of 3 and a multiple of 8 . Conversely, since 8 and 3 are coprime (i.e. they have no common factor greater than 1), any number which is a multiple of both 3 and 8 must be a multiple of 24 . It is therefore sufficient for us to count all the numbers of the required form which are multiples of both 3 and 8 .
The digit sum of 'pqrpqrpqr' is $3(p+q+r)$, which is always a multiple of 3 , so all numbers of the form 'pqrpqrpqr' are divisible by 3 (by the divisibility test for 3 ).
So now all we need to do is to count all the numbers of the required form which are multiples of 8 , since they will also be a multiple of 3 and hence a multiple of 24 .
By the divisibility test for 8 , we need the three-digit number 'pqr' to be divisible by 8 , and each three-digit multiple of 8 will give us a nine-digit number divisible by 8 . So all that remains is to count the three-digit multiples of 8 .
The smallest of these is $104(=13 \times 8)$ and the largest is $992(=124 \times 8)$, so there are 112 three-digit multiples of 8 and therefore 112 numbers of the form 'pqrpqrpqr' which are multiples of 24 .

Solution 2
As in Solution 1, we can establish that we need 'pqrpqrpqr' to be a multiple of both 3 and 8 .
Notice that 'pqrpqrpqr' $=1001001 \times$ pqr. 1001001 is divisible by 3 so every number of the form is 'pqrpqrpqr' divisible by 3 . Since 1001001 is odd, we need the three-digit number 'pqr' to be divisible by 8 .
There are 124 multiples of 8 less than 1000 ; of these 12 are less than 100 , so there are 112 three-digit multiples of 8 and hence 112 numbers with the properties given in the question.