```python
import math

def isPrime(n):
    if n == 1:
        return False;
    elif n%2 == 0 or n==2 :
        return True
    else:
        for i in range(3,int(math.sqrt(n))+1,2):
        #for i in range(2,n):
            if n % i == 0:
                return False
        return True
    

isPrime(13)             
```




    True




```python
for i in range(1,10):
    print(i)
    if isPrime(i):
        print(i,' is Prime')
```

    1
    2
    2  is Prime
    3
    3  is Prime
    4
    5
    5  is Prime
    6
    7
    7  is Prime
    8
    9



```python
from datetime import datetime

t = datetime.now()
print(isPrime(1000099))
t1 = datetime.now()

print('Time taken', (t1-t).microseconds, t1-t)
```

    True
    Time taken 132 0:00:00.000132



```python
# Another prime generation method
import sympy
is_prime = lambda x: sympy.isprime(x)


t = datetime.now()
print(is_prime(1000099))
t1 = datetime.now()
print('Time taken', (t1-t).microseconds, t1-t)
```

    True
    Time taken 143 0:00:00.000143


bc9f732d37ed95360218ef57fe3e9c63e500b0d9
ipynb
Jupyter Notebook
PrimeNumbers.ipynb
helloprasanna/python
1f218ddf84bc082dca5906833238389011ae344b
MIT
PrimeNumbers.ipynb
helloprasanna/python
1f218ddf84bc082dca5906833238389011ae344b
MIT
PrimeNumbers.ipynb
helloprasanna/python
1f218ddf84bc082dca5906833238389011ae344b
MIT
Qwen/Qwen-72B
1. YES
2. YES