Law of cosines - triples: Difference between revisions
Content added Content deleted
m (→using memoization: updated indentation for the output 2nd line.) |
m (→{{header|zkl}}: fix sort bug) |
||
Line 981: | Line 981: | ||
List(tri60,tri90,tri120) |
List(tri60,tri90,tri120) |
||
} |
} |
||
fcn abc(a,b,c){ List(a, |
fcn abc(a,b,c){ List(a,b).sort().append(c.toFloat().sqrt().toInt()) } |
||
fcn triToStr(tri){ // ((c,d,e),(a,b,c))-->"(a,b,c),(c,d,e)" |
fcn triToStr(tri){ // ((c,d,e),(a,b,c))-->"(a,b,c),(c,d,e)" |
||
tri.sort(fcn(t1,t2){ t1[0]<t2[0] }) |
tri.sort(fcn(t1,t2){ t1[0]<t2[0] }) |
||
Line 996: | Line 996: | ||
Integer triangular triples for sides 1..13: |
Integer triangular triples for sides 1..13: |
||
60° has 15 solutions: |
60° has 15 solutions: |
||
(1,1,1),(2,2,2),(3 |
(1,1,1),(2,2,2),(3,8,7),(3,3,3),(4,4,4),(5,8,7),(5,5,5),(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),(11,11,11),(12,12,12),(13,13,13) |
||
90° has 3 solutions: |
90° has 3 solutions: |
||
(3,4,5),(5,12,13),(6,8,10) |
(3,4,5),(5,12,13),(6,8,10) |