Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Solve the problem for prime numbers and composite numbers separately.
Multiply the number of permutations of prime numbers over prime indices with the number of permutations of composite numbers over composite indices.
The number of permutations equals the factorial.