- Home
·
- Math/Dates
·
- I wrote this code to solve the Goldbach Conjecture. The problem is explained in the code.
I wrote this code to solve the Goldbach Conjecture. The problem is explained in the code.
I wrote this code to solve the Goldbach Conjecture. The problem is explained in the code.
API Declarations
'Include two command buttons, a listbox, and a label
Rate I wrote this code to solve the Goldbach Conjecture. The problem is explained in the code.
(1(1 Vote))
Label1 = ""
List1.Clear
On Error GoTo Errorhandler
X = InputBox("Please Enter an Integer.", "Goldbach Conjecture")
If X <> "" Then
List1.AddItem Str(X)
Do While X <> 1
If X Mod 2 = 0 Then
X = X / 2
Else
X = (X * 3) + 1
End If
List1.AddItem Str(X)
Loop
'Number of steps used
Label1 = List1.ListCount - 1
End If
Errorhandler:
Exit Sub
End Sub
Private Sub Command2_Click()
nl = Chr$(13) & Chr$(10)
msg = "Even numbers are divided by 2" & nl
msg = msg & "Odd numbers are multiplied by 3 and are then increased by 1" & nl
msg = msg & "The problem ends by reaching the number 1"
MsgBox msg, , "Goldbach Conjecture Explained"
End Sub
I wrote this code to solve the Goldbach Conjecture. The problem is explained in the code. Comments
No comments yet — be the first to post one!
Post a Comment