Given that P is the set of all prime numbers between 0 and 10, and…