```
import time
print('Made by Yasas Kulatunga, Dhari Prashanth and Dhivy Prashanth')
print(' ')
number = int(input("Enter a Number: "))
print(' ')
time.sleep(0.5)
print('THINKING.')
time.sleep(0.5)
print('THINKING..')
time.sleep(0.5)
print('THINKING...')
time.sleep(0.5)
print(' ')
c = 0
while number:
for i in range(2,number):
if number % i == 0:
print(str(i),"times",str(number//i),"is",str(number))
time.sleep(0.3)
c = c + 1
if c == 0:
print(' ')
print(str(number),"has no factors apart from 1 and itself, therefore it is a prime number")
print(' ')
time.sleep(0.3)
else:
print(' ')
print(str(number),"is not a prime number, the number has factors more than 1 and the number itself.")
print(' ')
time.sleep(0.3)
number = int(input('Enter a number: '))
print(' ')
time.sleep(0.3)
c = 0
```

]]>Thank you for pointing the bug in my code. :)

I put in your line of code

for i in [2]+list(range(3, maxfact+1,2)):

and it works fine,

Except it shows 2 is not a prime.. If we sort this we're good.. I think..

And, what I just added, by skipping the even divisors!

For instance, if number is 29, your code checks the division by

2 3 4 5 6 7 8 9 10 11 12 13 ...29

But "mine" (& @ramvee) only

2 3 5

THINKING.

THINKING..

THINKING...

5 times 5 is 25

25 is not a prime number, the number has factors more than 1 and the number itself.

Enter a number:

]]>(Perhaps what @ccc minded with "less than 2")

```
for i in [2]+list(range(3, maxfact+1,2)):
```

]]>```
for i in range(2, maxfact+1):
```

]]>```
maxfact = int(sqrt(number)-1) -> maxfact = int(sqrt(number))
```

]]>https://primes.utm.edu/notes/faq/one.html

https://www.reference.com/math/0-prime-number-1964bd6272594f3f

https://primes.utm.edu/notes/faq/negative_primes.html

Because the largest factor of any number cannot exceed it's square root, there is no need for range to go beyond that.

With minimal alteration to script given by @ccc , this would be more efficient.

```
# Revised as per bug reported by @cvp
# This code takes care of numbers 1 and 2 also.
import time
from math import sqrt
print('Made by Yasas Kulatunga, Dhari Prashanth and Dhivy Prashanth')
print(' ')
number = int(input("Enter a Number: ").strip())
maxfact = int(sqrt(number)+1)
print(' ')
time.sleep(0.5)
print('THINKING.')
time.sleep(0.5)
print('THINKING..')
time.sleep(0.5)
print('THINKING...')
time.sleep(0.5)
print(' ')
while number:
for i in range(2, maxfact):
if number % i == 0:
print('{} is not prime.'.format(number))
break
else:
print('{} is prime!'.format(number))
number = int(input("Enter a Number: ").strip())
maxfact = int(sqrt(number)+1)
```

]]>Let's call this the 5F approach: finding first factor fast fail...

```
import time
print('Made by Yasas Kulatunga, Dhari Prashanth and Dhivy Prashanth')
print(' ')
number = int(input("Enter a Number: ").strip())
print(' ')
time.sleep(0.5)
print('THINKING.')
time.sleep(0.5)
print('THINKING..')
time.sleep(0.5)
print('THINKING...')
time.sleep(0.5)
print(' ')
while number:
for i in range(2, number):
if number % i == 0:
print('{} is not prime.'.format(number))
break
else:
print('{} is prime!'.format(number))
number = int(input("Enter a Number: ").strip())
```

]]>