Mathématiques

Question

Bonjour en math mon prof nous a demander à moi et ma classe de trouver en nombre premier comportant 10 chiffres sauf que je trouve pas pourriez-vous m’aider s’il vous plaît ?

1 Réponse

  • Bonsoir,

    Explications de mon commentaire:

    un petit programme en python

    import math

    a=1000000000

    for i in range(a+1,a+20,2):

      r=math.sqrt(i)

      print ('i=',i,'r=',r)

      j=3

      isprime=True

      while j< r:

         if i % j==0:

            print('divisible par ',j)

            isprime=False

            break

         #print (j,end=" ")

         

         j+=2

      #print ()

      if isprime:

         print (i)

Autres questions