fork(2) download
  1. def maior_primo(n):
  2. while n > 0:
  3. if all(n%j!=0 for j in range(2,n)):
  4. return n
  5. n -= 1
  6.  
  7. #n=int(input("Digite o valor de n>= 2.")) # 100
  8. n=100
  9. print(maior_primo(n)) # 97
Success #stdin #stdout 0.02s 28384KB
stdin
Standard input is empty
stdout
97