ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: Program to compute and print 1000th prime number
by Robert P. J. Day other posts by this author
Nov 7 2009 7:29AM messages near this date
Re: Program to compute and print 1000th prime number | Serious Privileges Problem: Please Help
On Sat, 7 Nov 2009, ssteinerX@[...].com wrote:

> 
>  On Nov 7, 2009, at 9:44 AM, Ray Holt wrote:
> 
>        I am taking the MIT online course Introduction to Computer Science and
>        Programming. I have a assignment to write a program to compute and print
>        the 1000th. prime number. Can someone give me some leads on the correct
>        code? Thanks, Ray
> 
> 
>  Copying code != doing an assignment. �Try Knuth.

  i was going to say much the same, but it's also worth pointing out
that, using standard techniques, there is no straightforward way to
print the n'th prime number, given some initial value of n.

  the ubiquitous sieve of eratosthenes requires you to pre-specify
your maximum value, after which -- once the sieve completes -- all you
know is that you have all of the prime numbers up to n.  whether
you'll have 1000 of them isn't clear, which means that you might have
to start all over with a larger maximum value.  (being able to
directly determine the n'th prime number would solve a *lot* of prime
number problems. :-)

  and given that one can google and, in seconds, have the solution, i
feel no guilt in referring to
http://code.activestate.com/recipes/366178/.

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================
Thread:
Ray Holt
Xavier Ho
Wayne Brehaut
John Posner
Mensanator
Andre Engels
ssteinerX@gmail.com
Raymond Hettinger
Robert P. J. Day
Robert P. J. Day

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved