 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Dascal triangle (Posted on 2016-02-02) Arrange integers 1- 15 in a triangle such that the upper row consists of 5 integers, all other rows represent each the absolute values of the differences between the adjacent members of the row above so that the 5th row contains one number only.

```4   7  15  10   2
3  12   5   8
9   7   * oops!  Can't use 3 again.```
Just wanted to explain the build-up..
Better luck to the solvers!

 No Solution Yet Submitted by Ady TZIDON No Rating Comments: ( Back to comment list | You must be logged in to post comments.) re(3): computer solution | Comment 4 of 8 | (In reply to re(2): computer solution by Charlie)

The generalized program with size 6 for the first row (triangular number = 21) finds no solutions:

DefDbl A-Z
Dim crlf\$, grid(20, 20), used(200), sz, tr

Form1.Visible = True

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

sz = 6
tr = sz * (sz + 1) / 2

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

End Sub

DoEvents
If row = 1 Then
For i = 1 To tr
If col = 1 Then Text1.Text = Text1.Text & Str(i) ' equivalent of a progress bar
If used(i) = 0 Then
grid(row, col) = i
used(i) = 1

r = row: c = col + 1
If c > sz Then r = r + 1: c = 1

used(i) = 0
End If
Next
Else
diff = Abs(grid(row - 1, col) - grid(row - 1, col + 1))
If used(diff) = 0 Then
grid(row, col) = diff
used(diff) = 1

r = row: c = col + 1
If c > sz + 1 - row Then r = r + 1: c = 1
If r < sz + 1 Then
Else
For r = 1 To sz
For c = 1 To sz + 1 - r
Text1.Text = Text1.Text & Str(grid(r, c))
Next c
Text1.Text = Text1.Text & crlf
Next r
Text1.Text = Text1.Text & crlf
End If

used(diff) = 0
End If
End If
End Sub

 Posted by Charlie on 2016-02-03 22:16:06 Please log in:

 Search: Search body:
Forums (0)