C# Implementation of Problem 3

View source code here on GitHub!

class p0003
: Euler.IEuler
object Answer ()
 1/*
 2Project Euler Problem 3
 3
 4More lazy functions this time. Took a little while to figure out how to
 5eliminate the special case for 2.
 6
 7Problem:
 8
 9The prime factors of 13195 are 5, 7, 13 and 29.
10
11What is the largest prime factor of the number 600851475143 ?
12*/
13using System;
14
15namespace Euler
16{
17    public class p0003 : IEuler
18    {
19        public object Answer()
20        {
21            return (short)Prime.PrimeFactors(600851475143).Max();
22        }
23    }
24}

Tags: prime-number, factorization, csharp-iterator