Exemplo n.º 1
0
        public void Solve() {
            List<long> L = new List<long>();
            var primes = new LongPrimeSequence().Where(x => x > 10).GetEnumerator(); //single digit number we don't care for
            primes.MoveNext();                                                        //prime the pump (pun intended)

            while (L.Count < 11) {                                                   //by the problem we only care about the first 11
                if (IsTruncatable(primes.Current)) {
                    L.Add(primes.Current);
                }

                primes.MoveNext();
            }

            Util.WL("The sum of the only eleven primes that are both truncatable left\nand right is {0}".FormatWith(L.Sum()));
        }
Exemplo n.º 2
0
 public void Solve() {
     long prime = new LongPrimeSequence().ElementAt(10001 - 1);
     Util.WL("Prime 10001 is {0}".FormatWith(prime));
 }