1 can't be in any of the 4 remaining spots. So we have: 2,3,5,7, 4,6,8 and 9.
total number of arrangements of 8 numbers in 4 slots is 8*8*8*8=8^4
for two primes with the possibility of repeating numbers is 4*4*4*4 (first two fours are for the primes and the second one is for the non primes)
for three primes and four primes we have 4*4*4*4. However, the three can be arranged as follows:
PP(NP)(NP): 4!/(2!2!)=6
PPP(NP): 4!/3!=4
PPPP: 4!/4!=1
4^4/8^8=4^4/(2^4*4^4)=1/16
Adding 6,4 and 1 and multiplying
...
total number of arrangements of 8 numbers in 4 slots is 8*8*8*8=8^4
for two primes with the possibility of repeating numbers is 4*4*4*4 (first two fours are for the primes and the second one is for the non primes)
for three primes and four primes we have 4*4*4*4. However, the three can be arranged as follows:
PP(NP)(NP): 4!/(2!2!)=6
PPP(NP): 4!/3!=4
PPPP: 4!/4!=1
4^4/8^8=4^4/(2^4*4^4)=1/16
Adding 6,4 and 1 and multiplying
...





