Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

Creating a prime number generator, need help!

$
0
0
Hey guys i'm new to programming and want to join a helpful community :). I'm hoping I came to the right place hehe

so lets jump right in it

Objective: Create a program the will get me to the 1000th prime number

This is what I did so far:

raw_input ("What prime do you wish to find?" )
#input what number you wish to find here
def generator():
i = 1
while True:
yield i
i = i + 1
#a generator to produce numbers
def prime(n):
for n in range(2, i):
if i % n != 0:
print i
#a prime detector, I honestly don't know how to do this at all -___- I just copied this bad boy from another forum

I think i need to establish something that detects how many primes are on the field too, but idk how :/. Any feedback helps :)

Viewing all articles
Browse latest Browse all 2703

Trending Articles