Tags

Tags

http://xkcd.com

Prime Numbers

Short script that will tell you all the prime numbers from zero to x. At the end it will tell the total of all the primes added together.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
 
stopat = int(raw_input("Enter a stopping point:"))
total = 0
 
count = 0
while count <= stopat:
	prime = True
	for x in range(2, count - 1):
		#print "Count: " + str(count) + "  X: " + str(x) + " Modulas: " + str(count % x)
		if count % x != 0:
			pass
		else:
			prime = False
	if prime == True:
		#print str(total) + " + " + str(count) + " = " + str(total+count)
		total = total + count
		print str(count) + " is a prime!"
	#print count
	#print "------------"
	count = count + 1
 
 
print "Total: " + str(total)

New Computer

image

October 2012

Case: Corsair Vengeance Series C70 Arctic White Steel ATX
Motherboard: ASUS P9X79 LGA 2011 Intel X79 SATA 6Gb/s USB 3.0 ATX UEFI BIOS
Graphics Card: EVGA GeForce GTX 650 2GB 128-bit GDDR5
Power Supply: CORSAIR CX Series CX750 750W
Memory: G.SKILL Ripjaws Z Series 32GB (4 x 8GB)
Processor: Intel Core i7-3820 Sandy Bridge-E 3.6GHz
Cooler: Antec Kuhler 620