# Finding 4-up numbers

From Mathcounts Target 2018:

1. A 4-up number is defined as a positive integer that is divisible by neither 2 nor 3 and does not have 2 or 3 as any of its digits. How many numbers from 400 - 600 inclusive are 4-up numbers?

So I tried to find the complement, which is a number that is either divisible by 2 or 3 or has 2 or 3 as a digit. This I could calculute using PIE. But then I ran into some nasty casework for the intersection of the two sets: when the number is divisble by 2 or 3 and has 2 or 3 as a digit.

Any help would be great. Thanks.

• Hint: count numbers without 2s and 3s which are not divisible by 2, then subtract numbers without 2s and 3s which are not divisible by 2 but are divisible by 3. For the latter, use the famous divisibility by 3 test to simplify the counting. Jul 31 '18 at 22:09

HINT.-You have to find the numbers of three digits $abc$ with the restrictions$$\begin{cases}a=4,5\\b=0,1,4,5,6,7,8,9\\c=1,5,7,9\end{cases}$$ Then you have in a first step $2\cdot8\cdot4=64$ possibilities from which as second and final step you have to discard those such that $a+b+c\equiv 0\pmod3$. For this you can calculate the number $n$ of solutions of the eight congruences and the answer will be $64-n$
$$1+b+1\equiv 0\pmod3\\1+b+5\equiv 0\pmod3\\1+b+7\equiv 0\pmod3\\1+b+9\equiv 0\pmod3\\2+b+1\equiv 0\pmod3\\2+b+5\equiv 0\pmod3\\2+b+7\equiv 0\pmod3\\2+b+9\equiv 0\pmod3$$ (The smaller of these last numbers is $405$ ans the largest of them is $597$).