Skip to content

Commit

Permalink
Merge pull request #15 from Mijo-Software/202112140019
Browse files Browse the repository at this point in the history
202112140019
  • Loading branch information
mjohne authored Dec 13, 2021
2 parents b674f3d + e8e9313 commit 555d357
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 52 deletions.
4 changes: 2 additions & 2 deletions EulerBricks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<PackageLicenseFile>C:\Users\mj-pr\OneDrive\Documents\unlicense.txt</PackageLicenseFile>
<Authors>Mijo Software</Authors>
<PackageProjectUrl>https://mijo-software.de</PackageProjectUrl>
<PackageReleaseNotes>1.2.0.5</PackageReleaseNotes>
<Version>1.2.1.6</Version>
<PackageReleaseNotes>1.2.2.7</PackageReleaseNotes>
<Version>1.2.2.7</Version>
<IsPublishable>False</IsPublishable>
<Description>Generates Euler bricks.</Description>
<Copyright>The Unlicense</Copyright>
Expand Down
107 changes: 57 additions & 50 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,64 +1,71 @@
//string length;

const ulong max = 1000;
namespace EulerBricks
{
internal class EulerBricks
{
public static void Main()
{
const ulong max = 1000;

ulong
n = 0, i = 0,
a_min = 1, b_min = 1, c_min = 1,
a_max = max, b_max = max, c_max = max;
ulong
n = 0, i = 0,
a_min = 1, b_min = 1, c_min = 1,
a_max = max, b_max = max, c_max = max;

double d, e, f, g;
double d, e, f, g;

Console.WriteLine(value: "EulerBricks");
Console.Write(value: "Input the length of the run (default=1000, hit ENTER): ");
string length = Console.ReadLine();
if (ulong.TryParse(s: length, result: out a_max))
{
b_max = c_max = a_max;
}
else
{
Console.WriteLine(value: "Default value loaded!");
a_max = b_max = c_max = max;
}
Console.WriteLine(value: "EulerBricks");
Console.Write(value: "Input the length of the run (default=1000, hit ENTER): ");
string length = Console.ReadLine();
if (ulong.TryParse(s: length, result: out a_max))
{
b_max = c_max = a_max;
}
else
{
Console.WriteLine(value: "Default value loaded!");
a_max = b_max = c_max = max;
}

for (ulong a = a_min; a < a_max; a++)
{
for (ulong b = b_min; b < b_max; b++)
{
for (ulong c = c_min; c < c_max; c++)
{
d = Math.Sqrt(d: Math.Pow(x: a, y: 2) + Math.Pow(x: b, y: 2));
if ((d % 1) == 0)
for (ulong a = a_min; a < a_max; a++)
{
e = Math.Sqrt(d: Math.Pow(x: a, y: 2) + Math.Pow(x: c, y: 2));
if ((e % 1) == 0)
for (ulong b = b_min; b < b_max; b++)
{
f = Math.Sqrt(d: Math.Pow(x: b, y: 2) + Math.Pow(x: c, y: 2));
if ((f % 1) == 0)
for (ulong c = c_min; c < c_max; c++)
{
n++;
if (a <= b && a <= c && b <= c)
d = Math.Sqrt(d: Math.Pow(x: a, y: 2) + Math.Pow(x: b, y: 2));
if ((d % 1) == 0)
{
i++;
Console.WriteLine(value: $"{n}|{i} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}");
}
else
{
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.WriteLine(value: $"{n}|{i} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}");
Console.ForegroundColor = ConsoleColor.White;
}
g = Math.Sqrt(d: Math.Pow(x: a, y: 2) + Math.Pow(x: b, y: 2) + Math.Pow(x: c, y: 2));
if ((g % 1) == 0)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(value: $"{n}|{i} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}{{g: {Math.Round(a: (double)g)}");
Console.ForegroundColor = ConsoleColor.White;
e = Math.Sqrt(d: Math.Pow(x: a, y: 2) + Math.Pow(x: c, y: 2));
if ((e % 1) == 0)
{
f = Math.Sqrt(d: Math.Pow(x: b, y: 2) + Math.Pow(x: c, y: 2));
if ((f % 1) == 0)
{
n++;
if (a <= b && a <= c && b <= c)
{
i++;
Console.WriteLine(value: $"{n}|{i} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}");
}
else
{
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.WriteLine(value: $"{n}|{i} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}");
Console.ForegroundColor = ConsoleColor.White;
}
g = Math.Sqrt(d: Math.Pow(x: a, y: 2) + Math.Pow(x: b, y: 2) + Math.Pow(x: c, y: 2));
if ((g % 1) == 0)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(value: $"{n}|{i} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}{{g: {Math.Round(a: (double)g)}");
Console.ForegroundColor = ConsoleColor.White;
}
}
}
}
}
}
}
}
}
}
}

0 comments on commit 555d357

Please sign in to comment.