Python Forum
check if the number is a prime integer
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
check if the number is a prime integer
#3
Efficiency is not very important here as only one number is checked but still I would grab low hanging fruits first and only after that deploy brute force.

'low hanging fruits':

- if number is 1 -> not prime
- if number is even -> not prime

'brute force'

- check quotient, but only by dividing with odd numbers (as we already determined that number is not even)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
RE: check if the number is a prime integer - by perfringo - Sep-26-2019, 04:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Prime number detector Mark17 5 884 Nov-27-2023, 12:53 PM
Last Post: deanhystad
  extracting x from '(x)' as an integer number Hwolff1962 3 926 Mar-23-2023, 02:50 PM
Last Post: Hwolff1962
  Pairs of multiplied prime number--->N Frankduc 13 3,642 Jan-16-2022, 01:52 PM
Last Post: Frankduc
  Factorial Code is not working when the given number is very long integer Raj_Kumar 2 2,340 Mar-31-2020, 06:40 PM
Last Post: deanhystad
  How to check if user entered string or integer or float?? prateek3 5 11,413 Dec-21-2019, 06:24 PM
Last Post: DreamingInsanity
  Is 2 a prime number? for loop & range fuction in python docs says yes, mine says no. allusernametaken 4 2,970 Nov-17-2019, 02:56 AM
Last Post: allusernametaken
  Error when entering letter/character instead of number/integer helplessnoobb 2 7,153 Jun-22-2019, 07:15 AM
Last Post: ThomasL
  Creating a program to look for the largest prime number of a number Wikki14 4 3,944 Sep-08-2018, 12:30 AM
Last Post: Skaperen
  Unexpected result in simple prime number example jackhj 2 3,052 Apr-20-2018, 01:48 AM
Last Post: jackhj
  python prime number algorithm zowhair 3 3,855 Dec-20-2017, 06:22 PM
Last Post: zowhair

Forum Jump:

User Panel Messages

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