By adding 1 to the non leading zeros number N= AABBCCDD, we get a perfect square. Find N.
(A, B, C and D are different base ten digits.)
*** AABBCCDD denotes the concatenation of the digits and not their product .
Note: For an extra challenge, solve this puzzle without using a computer program aided method.
N sqrt(N+1)
11336688 3367
22886655 4784
44009955 6634
DefDbl A-Z
Dim crlf$, used(9)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 1 To 9
used(a) = 1
For b = 0 To 9
If used(b) = 0 Then
used(b) = 1
For c = 0 To 9
If used(c) = 0 Then
used(c) = 1
For d = 0 To 9
If used(d) = 0 Then
used(d) = 1
aabbccddplus = 11000000 * a + 110000 * b + 1100 * c + 11 * d + 1
sr = Int(Sqr(aabbccddplus) + 0.5)
If sr * sr = aabbccddplus Then
Text1.Text = Text1.Text & aabbccddplus - 1 & " " & sr & crlf
End If
used(d) = 0
End If
Next
used(c) = 0
End If
Next
used(b) = 0
End If
Next
used(a) = 1
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
|
Posted by Charlie
on 2016-05-16 16:23:10 |