-
Notifications
You must be signed in to change notification settings - Fork 0
/
sieveOfEratosthenes.py
55 lines (39 loc) · 1.01 KB
/
sieveOfEratosthenes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
from math import *
import time
import matplotlib.pyplot as plt
import energyusage as eu
def cancel(listing, start):
for i in range(len(listing)):
listing[i] = False
return listing
def lookup(const, start, listing):
ii = cancel(listing, start)
for i in range(start, floor(sqrt(const))):
if ii[i] == False:
print("%s is Prime"% str(i) + "\n")
for j in range(i*i, len(ii) , i):
ii[j] = True
print(str(ii) + "\n")
return ii
def master(const, start, listing):
ii = lookup(const, start, listing)
for i in range(floor(sqrt(const)+1), len(listing)):
if ii[i] == False:
print("%s is Prime"%str(i) + "\n")
pass
pass
pass
startTime = time.time()
#print(gestrichen)
const = int(input("Const please: "))
start = int(input("Start please: "))
gestrichen = [i for i in range(start, const)]
print("It´s began")
master(const, start, gestrichen)
dir(eu)
"""
t = int(input("Number of test cases: "))
if t <= 10:
for i in range(t):
"""