Prime class has 5 methods,
- To find nth prime
- To check whether a number is prime or not
- To get next prime
- To get previous prime
- To get all prime less than a number
All methods are stateless. Give input and get output. It't just that simple!!
from prime import Prime p = Prime()
p.nthprime(500) ## get 500th prime Output: 3571
p.isprime(23) ## check whether 23 is prime or not Output: True
p.getnextprime(20) ## Get prime after 20 Output: 23
p.getpreviousprime(20) ## Get prime before 19 __output:__19
p.getallprimes(20) ## Get all primes less than 20 Output:[2, 3, 5, 7, 11, 13, 17, 19]