Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
from math import factorial
|
||||
|
||||
def is_wprime(n):
|
||||
return n == 2 or (
|
||||
n > 1
|
||||
and n % 2 != 0
|
||||
and (factorial(n - 1) + 1) % n == 0
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
c = int(input('Enter upper limit: '))
|
||||
print(f'Primes under {c}:')
|
||||
print([n for n in range(c) if is_wprime(n)])
|
||||
Loading…
Add table
Add a link
Reference in a new issue