This Python script will generate a list of prime number.
1 2 3 4 5 6 7 8 9 | def isPrime(x): for i in range(2, x): if x%i == 0: return false return true for c in range(1,10): if isPrime(c): print c, |
output:
>>> 1 2 3 5 7
Related Articles:
Popular Articles:
- Backup folders with 7-zip command line
- Insert figures to LaTeX
- Create LaTeX table easily
- Add personal signature to Lotus Notes 7
- Windows XP Service Pack 3 Final release download
Spread/Promote this article.
Digg | Del.icio.us | Stumble | Y! MyWeb | Y! Buzz | Fave It! | RedditSubscribe for free.
Subscribe to Selinap.com feed right now!
Tags: prime number, Python
