Python Forum
calculate the 10001st prime number
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
calculate the 10001st prime number
#3
Two clues for speeding up the algorithm:
a. You can increment by 2 each time, since we know that even numbers can't be prime.
b. the algorithm does not have to increment up to the number, since we also know that the largest prime can't be more than the square root of the number.

Lewis
To paraphrase: 'Throw out your dead' code. https://www.youtube.com/watch?v=grbSQ6O6kbs Forward to 1:00
Reply


Messages In This Thread
calculate the 10001st prime number - by topologh - Mar-30-2018, 10:59 AM
RE: calculate the 10001st prime number - by Zatox11 - Mar-30-2018, 05:30 PM
RE: calculate the 10001st prime number - by ljmetzger - Mar-30-2018, 06:30 PM
RE: calculate the 10001st prime number - by Zatox11 - Mar-30-2018, 07:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to find the next prime number FirstBornAlbratross 8 5,217 Aug-14-2023, 01:16 PM
Last Post: deanhystad
  Calculate the multiple of a number pythonuser1 7 4,728 Mar-27-2020, 02:22 PM
Last Post: deanhystad
  Prime number code ryfoa6 3 3,047 Mar-21-2020, 12:23 AM
Last Post: ryfoa6
  Trouble interpreting prime number code ryfoa6 1 2,383 Mar-20-2020, 03:47 PM
Last Post: stullis
  Prime number Python homework mkrisz98 11 5,925 May-10-2019, 05:23 PM
Last Post: mkrisz98
  how to find a next prime number? iamyourfather 2 6,685 Oct-01-2017, 04:21 PM
Last Post: gruntfutuk

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020