Skip to content

Instantly share code, notes, and snippets.

@Visgean
Created July 14, 2011 13:51
Show Gist options
  • Select an option

  • Save Visgean/1082491 to your computer and use it in GitHub Desktop.

Select an option

Save Visgean/1082491 to your computer and use it in GitHub Desktop.
Prime numbers generator
#! /usr/bin/python
# -*- coding: UTF-8 -*-
# Prime numbers
# @author: Visgean Skeloru
# email: <visgean@gmail.com>
# jabber: <visgean@jabber.org>
# github: http://github.com/Visgean
numbers = range(3, int(raw_input("Max value: ")) + 1, 2)
print 2
for n in numbers:
print n
maxMultiple = numbers[-1] / n
while maxMultiple > 1:
try:
numbers.remove(n * maxMultiple)
except:
pass
maxMultiple -= 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment