<s>[INST] Find the probability that $1984!$ is divisible by $n$ 
Let $a,b,c,d$ be a permutation of the numbers $1,9,8,4$ and let $n = (10a+b)^{10c+d}$. Find the probability that $1984!$ is divisible by $n$.

I was told this could be solved by casework on $a$ and using Fermat's Little Theorem. For example, if $a = 1$, there are $6$ possibilities; if $a = 4$, there are $4$ possibilities; and if $a = 8,9$, there are $5$ possibilities.
How do I use Fermat's Little Theorem to get this?
 [/INST] The following PARI/GP program determines the permutations for which
$1984!$ divides the given number :
? q=0;x=[1,9,8,4];for(j=1,24,p=numtoperm(4,j);a=x[p[1]];b=x[p[2]];c=x[p[3]];d=x[
p[4]];if(Mod(1984!,(10*a+b)^(10*c+d))==0,q=q+1;print(q,"      ",a," ",b,"
",c," ",d)))
1      1 9       4 8
2      1 8       9 4
3      1 8       4 9
4      1 4       9 8
5      1 4       8 9
6      9 1       8 4
7      9 1       4 8
8      9 8       1 4
9      9 8       4 1
10      9 4       1 8
11      8 1       9 4
12      8 1       4 9
13      8 9       1 4
14      8 4       1 9
15      8 4       9 1
16      4 9       1 8
17      4 9       8 1
18      4 8       1 9
19      4 8       9 1
20      1 9       8 4
?

The failing permutations are :
? q=0;x=[1,9,8,4];for(j=1,24,p=numtoperm(4,j);a=x[p[1]];b=x[p[2]];c=x[p[3]];d=x[
p[4]];if(Mod(1984!,(10*a+b)^(10*c+d))<>0,q=q+1;print(q,"      ",a," ",b,"
",c," ",d)))
1      9 4       8 1
2      8 9       4 1
3      4 1       9 8
4      4 1       8 9
?

So, $20$ out of the $24$ permutations are sucessful. Therefore, the probability that $1984!$ divides the number is $\frac{5}{6}$.
</s>