Special pythagorean triplet: Difference between revisions

Content added Content deleted
Line 60: Line 60:


=={{header|F_Sharp|F#}}==
=={{header|F_Sharp|F#}}==
Here I present a solution based on the ideas on the discussion page. It finds all Pythagorean triplets whose elements sum to a given value. It runs in O[n] time. Normally I would exclude triplets with a common factor but for this demonstration it is better to leave them.
Here I present a solution based on the ideas on the discussion page. It finds all Pythagorean triplets whose elements sum to a given value. It runs in O[n] time. Normally I would exclude triplets with a common factor but for this demonstration I prefer to leave them.
<lang fsharp>
<lang fsharp>
// Special pythagorean triplet. Nigel Galloway: August 31st., 2021
// Special pythagorean triplet. Nigel Galloway: August 31st., 2021