namespace Day8; public static class Primes { public static IEnumerable Factorize(long num) { var remainder = num; for (var c = 2; c < remainder / 2; c++) { if (remainder % c == 0) { yield return c; remainder /= c; c = 2; } } yield return remainder; } }