human
Check if a number is Quartan Prime or not | Utility function to check if a number is prime or not.
Corner cases.
This is checked so that we can skip middle five numbers in below loop.
Driver Code.
Check if number is prime and of the form 16 * n + 1"
How can the above be solved in Python?
 What is a code to check if a number is Quartan Prime or not and the other steps required?
assistant
#Here is code to check if a number is Quartan Prime or not and the other steps required.
 def isPrime ( n ) :
	if ( n <= 1 ) :
		return False
	if ( n <= 3 ) :
		return True
	if ( n % 2 == 0 or n % 3 == 0 ) :
		return False
	i = 5
	while ( i * i <= n ) :
		if ( n % i == 0 or n % ( i + 2 ) == 0 ) :
			return False
		i = i + 6
	return True
n = 17
if ( isPrime ( n ) and ( n % 16 == 1 ) ) :
	print ( " YES " )
else :
	print ( " NO " )