# Programmer: Sriram Pemmaraju
# Date: Jan 30th, 2012
# This program reads a positive integer, greater than 1 and
# determines whether this integer is a prime or not.
# Version 1

import time # the time module is need for functions that help time our code

# Input 
n = int(raw_input("Please type a positive integer, greater than 1: "))

factor = 2 # initial value of possible factor
isPrime = True # variable to remember if n is a prime or not


start = time.time() # remembers the time at which the loop started
# loop to generate and test all possible factors
while factor < n:
    # test if n is evenly divisible by factor
    if (n % factor == 0):
        isPrime = False
        break
    
    factor = factor + 1

end = time.time() # remembers the time at which the loop ended
elapsedTime = end - start
    
# Output 
if isPrime:
    print n, " is a prime."
else:
    print n, " is a composite."

print "The while-loop took ", elapsedTime, "seconds."
