Skip to content

Instantly share code, notes, and snippets.

@donma
Created October 29, 2025 07:11
Show Gist options
  • Select an option

  • Save donma/374e4341a9a934824e28cef1be34d3ad to your computer and use it in GitHub Desktop.

Select an option

Save donma/374e4341a9a934824e28cef1be34d3ad to your computer and use it in GitHub Desktop.
var sp = new Stopwatch();
sp.Start();
Parallel.For(1, 10, a =>
{
Parallel.For(1, 10, b =>
{
Parallel.For(1, 10, c =>
{
Parallel.For(1, 10, d =>
{
long left = 25870 + a;
int right = (int)Math.Pow(2, b) * c * d * d * 11; // 2^b * c * d² * 11
if (left == right)
{
Console.WriteLine($"a={a}, b={b}, c={c}, d={d}, sum={left}");
}
});
});
});
});
Console.WriteLine(sp.Elapsed);
//a=2, b=3, c=6, d=7, sum=25872
//a=2, b=4, c=3, d=7, sum=25872
//00:00:00.0154183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment