private static void Main(string[] args) { var calculator = new Calculator(); var difference = calculator.SquareOfSum(1, 100) - calculator.SumOfSquares(1, 100); Console.WriteLine("Difference is {0}", difference); Console.ReadKey(); }
static void Main(string[] args) { var n = 600851475143; Console.WriteLine(string.Format("What is the largest prime factor of the number {0}?", n)); var calculator = new Calculator(); var result = calculator.GetPrimes(n); Console.WriteLine("Answer" + result.Max()); Console.ReadKey(); }
private static void Main(string[] args) { var number = 1; var calculator = new Calculator(); Console.WriteLine(string.Format("Finding the smallest divisor for {0}", number)); var found = false; while (found == false) for (var i = 1; i <= 20; i++) if (calculator.IsDivisable(number, i)) { if (i == 20) found = true; } else { number++; break; } Console.WriteLine(string.Format("The smallest divisor is: {0}", number)); Console.ReadKey(); }