add primality and perfect square check