utility functions for isPrime