Skip to content

Instantly share code, notes, and snippets.

@smrfeld
Last active June 26, 2022 19:28
Show Gist options
  • Save smrfeld/838af465a4db5589feb9a63319c5e02b to your computer and use it in GitHub Desktop.
Save smrfeld/838af465a4db5589feb9a63319c5e02b to your computer and use it in GitHub Desktop.
Skeleton for simplified Pythagorean triplet
var soln = new List<(int a, int b, int c)>();
// Bound for a
// NOTE: this is a first guess, we'll do better later
// a + b + c = N => If all are equal, upper bound is N/3
double aMax = n / 3.0;
for (int a=1; a<aMax; a++)
{
// Find b,c ...
soln.Add((a, b, c));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment