Tester la conjecture de Goldbach
from math import * def nombre_premier(n): if n>1: for k in range(2,sqrt(n)+1): if k<n and n%k==0: #need k<n if n=2 return False return True def liste(n): return [k for k in range(1,n+1) if nombre_premier(k)==True] def goldbach(n): #solution=0 if n<3: return "C'est inferieur a trois" elif n%2!=0: return "C'est impair" else: for i in range(len(liste(n))): for j in range(i,len(liste(n))): if liste(n)[i]+liste(n)[j]==n: #solution+=1 print(liste(n)[i],liste(n)[j]) #return solution