Esempio n. 1
0
        public void Problem43()
        {
            var list = this.GetPerms(0, 10).Select(x => new { Orig = x, Split = this.Split(x, 3) });
            var hmm  = list.
                       Select(x => new
            {
                x.Orig,
                Split = x.Split.Item2.
                        Aggregate(x.Split.Item1.ToEnumerable(), (y, i) => y.Concat(y.Last().Skip(1).Concat(i))).Skip(1)
            }
                              );
            var ooo         = hmm.Select(x => new { x.Orig, Nums = x.Split.Select(MathsHelper.ConvertToDecimal) });
            var primes      = MathsHelper.GetPrimesUpTo(17).ToList();
            var interesting = ooo.Where(x => x.Nums.Zip(primes, (a, b) => a % b).All(y => y == 0)).ToList();
            var thingy      = interesting.Select(x => x.Orig.Reverse().ToList()).ToList();


            var hello = BigNumberHelper.AddListRepresentingNumbers(thingy);
        }
Esempio n. 2
0
        public long Problem10()
        {
            Func <long, int, long> func = (l, i) => l + i;

            return(MathsHelper.GetPrimesUpTo(2000000).Aggregate(0, func));
        }
Esempio n. 3
0
        public int Problem41()
        {
            var primes = MathsHelper.GetPrimesUpTo(987654321);

            return(primes.Last(this.IsPandigital));
        }