#Problem Set 1A
#Display Prime Numbers 1 to 1000
from math import sqrt # import the square root function
count = 1 # variable for counting 1 to 1000
display_prime = 0 # variable to finally value to be displayed
oddnum = 0 # variable for odd number to be checked from possible prime
count_primecheck = 0 # variable for counting which numbers to check against odd number
finalcheck = 0 # variable for remainder of the final check for prime
while (count <= 1000): # Loop for checking number from 1 to 1000
count += 1
if count == 2: # Check to see if number is equal to 2 if so display it
display_prime = count
print display_prime
if count%2 != 0: # Check to see if number is odd
oddnum = count
count_primecheck =1
while (count_primecheck < sqrt(oddnum)): # If number is odd preform following checks until
# the square root of that number is reached
count_primecheck +=1
finalcheck = oddnum%count_primecheck
if finalcheck == 0: # If the remainder is equal to zero check next number
count_primecheck +=1
break
if finalcheck !=0 and count_primecheck > sqrt(oddnum): # If the remainder is not equal to zero and the
# the square root has been reached dispaly number
display_prime = oddnum
print display_prime
#Problem Set 1B
#Get range of prime numbers from user and display "sum of the logarithms" and the "ratio of the sum"
from math import * # import the square root and log function
count = 1 # variable for counting 1 to the range given
display_prime = 0 # variable to finally value to be displayed
oddnum = 0 # variable for odd number to be checked from possible prime
count_primecheck = 0 # variable for counting which numbers to check against odd number
finalcheck = 0 # variable for remainder of the final check for prime
total = 0 # variable for sum of logarithms
ratio = 0.0 # variable for the ratio of the sum of logarithms
range_input = raw_input ("Enter Number ") # Get user number input
while (count < int(range_input)): # Loop for checking number from 1 to the length given
count += 1
if count == 2: # Check to see if number is equal to 2 if so add the sum of the logarithm
display_prime = count
total += log(2)
if count%2 != 0: # Check to see if number is odd
oddnum = count
count_primecheck =1
while (count_primecheck < sqrt(oddnum)): # If number is odd preform following checks until
# the square root of that number is reached
count_primecheck +=1
finalcheck = oddnum%count_primecheck
if finalcheck == 0: # If the remainder is equal to zero check next number
count_primecheck +=1
break
if finalcheck !=0 and count_primecheck > sqrt(oddnum): # If the remainder is not equal to zero and the
# the square root has been reached add the sum of the logarithm
display_prime = oddnum
total += log(display_prime)
print "The sum of the logarithms of all primes from 2 to",range_input,":", total
ratio = total/int(range_input)
print "The ratio of the sum logarithms:", ratio
# Problem Set 0
# Print First and Last Name
last_name = raw_input("Enter in your Last Name\n**") #Get users Last Name
first_name = raw_input ("Enter in your First Name\n**") #Get user First Name
print first_name #Display First Name
print last_name #Display Last Name