def maior_primo(n):
while n > 0:
if all(n%j!=0 for j in range(2,n)):
return n
n -= 1
#n=int(input("Digite o valor de n>= 2.")) # 100
n=100
print(maior_primo(n)) # 97
ZGVmIG1haW9yX3ByaW1vKG4pOgogICAgd2hpbGUgbiA+IDA6CiAgICAgICAgaWYgYWxsKG4laiE9MCBmb3IgaiBpbiByYW5nZSgyLG4pKToKICAgICAgICAgICAgcmV0dXJuIG4KICAgICAgICBuIC09IDEKCiNuPWludChpbnB1dCgiRGlnaXRlIG8gdmFsb3IgZGUgbj49IDIuIikpICMgMTAwCm49MTAwCnByaW50KG1haW9yX3ByaW1vKG4pKSAjIDk3