N is a perfect square containing precisely one 3, two 2’s and three 1’s. Any of the other seven digits may or may not occur in N.
Determine the smallest two values of N.
sqrt(N) N 3361 11296321
3483 12131289
3596 12931216
3623 13126129
3889 15124321
4373 19123129
4649 21613201
5489 30129121
5579 31125241
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For sr = 317 To 9999
DoEvents
sq$ = LTrim(Str(sr * sr))
ReDim ct(9)
For i = 1 To Len(sq)
ct(Val(Mid(sq, i, 1))) = ct(Val(Mid(sq, i, 1))) + 1
Next
If ct(1) = 3 And ct(2) = 2 And ct(3) = 1 Then
Text1.Text = Text1.Text & sr & " " & sq & crlf
End If
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
Edited on November 28, 2015, 8:56 am
|
Posted by Charlie
on 2015-11-27 15:30:18 |