All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Only 2 answers (Posted on 2015-08-26)
Using each of the digits 1, 2, 3, and 4 twice, write out an eight-digit number in which there is one digit between the 1s, two digits between the 2s,
three digits between the 3s, and four digits between the 4s.

Credit: A. Savin

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 1 of 3
23421314
41312432

DefDbl A-Z
Dim crlf\$

Form1.Visible = True

Text1.Text = ""
crlf = Chr\$(13) + Chr\$(10)

s\$ = "11223344"
h\$ = s
Do
ix1 = InStr(s, "4")
ix2 = InStr(ix1 + 1, s, "4")
If ix2 = ix1 + 5 Then
ix1 = InStr(s, "3")
ix2 = InStr(ix1 + 1, s, "3")
If ix2 = ix1 + 4 Then
ix1 = InStr(s, "2")
ix2 = InStr(ix1 + 1, s, "2")
If ix2 = ix1 + 3 Then
ix1 = InStr(s, "1")
ix2 = InStr(ix1 + 1, s, "1")
If ix2 = ix1 + 2 Then
Text1.Text = Text1.Text & s & crlf
End If
End If
End If
End If
permute s
Loop Until s = h

Text1.Text = Text1.Text & crlf & " done"

End Sub

 Posted by Charlie on 2015-08-26 11:17:03

 Search: Search body:
Forums (0)