... Nb premiers de 10^11 à 10^11 + 1000 ...

fred.toto Messages postés 73 Date d'inscription mardi 10 avril 2001 Statut Membre Dernière intervention 4 mars 2009 - 10 févr. 2005 à 21:27
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 - 11 févr. 2005 à 01:18
Salut tout le monde,
j'ai un programme à faire qui trouve et affiche tous les nombres premiers entre 10 puissance 11 ( 100 milliards) et 10puissance 11 + 1000... Avis aux amateurs
Fred.

1 réponse

Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
11 févr. 2005 à 01:18
Option Explicit


Private Sub Form_Load()
Dim x As Variant
x = CDec(10000000000000#)
Premier (x)
End Sub


Private Sub Premier(XX As Variant)
Dim i As Long
Dim j As Long
Dim Z As Variant
Dim Q As Variant
Dim R As Variant

Z = CDec(0)
Q = CDec(0)
R = CDec(0)

For j = 1 To 1000
DoEvents
XX = XX + 1
Z = Fix(Sqr(XX))
For i = 2 To Z
Q = XX / i
R = Q - Fix(Q)
If R = 0 Then GoTo 20
' DoEvents
Next
MsgBox XX & " est premier": Exit Sub
20 Next
MsgBox XX & " n'est pas premier"

End Sub

Daniel
0
Rejoignez-nous