diff options
Diffstat (limited to 'aoc2019/Util.cs')
-rw-r--r-- | aoc2019/Util.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/aoc2019/Util.cs b/aoc2019/Util.cs new file mode 100644 index 0000000..28991e1 --- /dev/null +++ b/aoc2019/Util.cs @@ -0,0 +1,17 @@ +namespace aoc2019; + +internal static class Util +{ + public static long Lcm(long a, long b) => a * b / Gcd(a, b); + + private static long Gcd(long a, long b) + { + while (true) + { + if (b == 0) return a; + var a1 = a; + a = b; + b = a1 % b; + } + } +} \ No newline at end of file |