2021-09-17 14:06:04 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2021-09-17 14:38:56 +02:00
|
|
|
"""Détermine si un entier N est premier"""
|
2021-09-17 14:06:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
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()
|