 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Total Triplet Treat (Posted on 2015-02-09) Denote the respective length, breadth, width and the space diagonal of a rectangular cuboid as L, B, W and D.

Determine the total number of triplets (L, B, W) such that each of L,B,W and D is a positive integer with L+B+W = 29.

*** Order does not matter. For example (1,5,7) and (7,5,1) would be considered as different triplets.

 No Solution Yet Submitted by K Sengupta No Rating Comments: ( Back to comment list | You must be logged in to post comments.) computer solution Comment 1 of 1
`L B  W  D4 5 20 214 20 5 215 4 20 215 20 4 216 6 17 196 17 6 198 9 12 178 12 9 179 8 12 179 12 8 1712 8 9 1712 9 8 1717 6 6 1920 4 5 2120 5 4 21`

There are only three basic solutions, with diagonals 17, 19 and 21. But since permutations are to be counted separately (I would describe that as "order does matter"), there are 15 such triplets, as two of the basic solutions have all different dimensions and thus 6 permutations, and one solution has a duplicated dimension and so has only 3 permutations.

DefDbl A-Z
Dim crlf\$

Function mform\$(x, t\$)
a\$ = Format\$(x, t\$)
If Len(a\$) < Len(t\$) Then a\$ = Space\$(Len(t\$) - Len(a\$)) & a\$
mform\$ = a\$
End Function

Text1.Text = ""
crlf\$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents

tot = 29
For l = 1 To 27
For b = 1 To 29 - l - 1
w = 29 - l - b
dsq = l * l + b * b + w * w
sr = Int(Sqr(dsq) + 0.5)
If sr * sr = dsq Then
Text1.Text = Text1.Text & l & Str(b) & Str(w) & Str(sr) & crlf
End If
Next
Next

Text1.Text = Text1.Text & " done"

End Sub

 Posted by Charlie on 2015-02-09 14:40:57 Please log in:

 Search: Search body:
Forums (0)