[ create a new paste ] login | about

Project: programmingpraxis
Link: http://programmingpraxis.codepad.org/pfWv4jzk    [ raw code | output | fork ]

programmingpraxis - Python, pasted on Jul 31:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def is_prime(n):
    if n < 2:
        return 0
    i = 2
    while i * i <= n:
        if n % i == 0:
            return 0
        i = i + 1
    return 1

def prime(n):
    i = 1
    while 0 < n:
        if is_prime(i):
            n = n - 1
        i = i + 1
    return i - 1

print prime(1000)


Output:
1
7919


Create a new paste based on this one


Comments: