Advertisement
kajs54

ex 5 s10

May 4th, 2022
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. def saisie():
  2. n=input("n:")
  3. return n
  4. def premier(n):
  5. c=0
  6. for i in range(2,(n//2)+1):
  7. if n%i==0:
  8. c=c+1
  9. return (c==0)
  10. def superpremier(n):
  11. test=True
  12. i=len(n)-1
  13. while test==True and i!=0:
  14. if not(premier(int(n[0:i]))==True):
  15. test=False
  16. i=i-1
  17. return test==True
  18. n=saisie()
  19. if superpremier(n)==True:
  20. print("est super premier")
  21. else:
  22. print("non")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement