Sep-12-2019, 12:41 PM
(This post was last modified: Sep-12-2019, 12:42 PM by YoungGrassHopper.)
(Sep-12-2019, 12:21 PM)perfringo Wrote: I am afraid that you are very far from determining primes.
Maybe something along those lines:
def prime_checker(integer): if integer == 2: # eliminate 2 return True if integer == 1 or integer % 2 == 0: # eliminate 1 and all even integers return False for i in range(3, integer, 2): # divide only with odd numbers as integer can't be even if integer % i == 0: return False else: return True
Very elaborate and sensible, I see now my very last attempts using if + and + or is rather flawed and the first if + for loop was closer to the truth however inefficient?
To tell the truth I haven't ever dug this deep in primes and my math skills I cannot brag about.
I just have so many tasks to get done so I am trying to rush through it without giving some of them the required thought like with this one.
I appreciate your input perfringo thanks for all the help.