21 lines
332 B
Python
21 lines
332 B
Python
#!/usr/bin/env python
|
|
|
|
"""Détermine si un entier N est premier"""
|
|
|
|
|
|
def main() -> None:
|
|
|
|
print(EstPremier(47, 47 // 2))
|
|
|
|
|
|
def EstPremier(N : int, i : int) -> bool:
|
|
if i == 1:
|
|
return True
|
|
elif N % i == 0:
|
|
return False
|
|
else:
|
|
return EstPremier(N, i - 1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|