fred.toto
Messages postés73Date d'inscriptionmardi 10 avril 2001StatutMembreDernière intervention 4 mars 2009
-
10 févr. 2005 à 21:27
Gobillot
Messages postés3140Date d'inscriptionvendredi 14 mai 2004StatutMembreDernière intervention11 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.
Gobillot
Messages postés3140Date d'inscriptionvendredi 14 mai 2004StatutMembreDernière intervention11 mars 201934 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"