We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12dbb6f commit dcf7795Copy full SHA for dcf7795
SieveOfEratosthenes.py
@@ -0,0 +1,11 @@
1
+print 'Show prime numbers till: '
2
+x = int(raw_input())
3
+numlist = range(2,x+1)
4
+for num in numlist:
5
+ p = 2
6
+ while p < 50:
7
+ if (p * num) in numlist:
8
+ numlist.remove(p * num)
9
+ p = p + 1
10
+print numlist
11
+print 'Prime numbers till {0} are {1}'.format(x, len(numlist))
0 commit comments