public IEnumerable <int> Problem13() { var list = new List <List <int> >(); var fileLines = File.ReadAllLines("C:\\Phil\\PE\\ProjectEuler\\ProjectEuler\\Problems\\BigNumbers.txt").ToList(); var nums = fileLines.Select(BigNumberHelper.GetAsListRepresentingNumber).ToList(); return(BigNumberHelper.AddListRepresentingNumbers(nums).ToArray().Reverse().Take(10)); }
public int Problem25() { List <int> result = new List <int>(); List <int> prevprev = BigNumberHelper.GetAsListRepresentingNumber(1); List <int> prev = BigNumberHelper.GetAsListRepresentingNumber(1); int n = 2; while (result.Count() < 1000) { result = BigNumberHelper.AddListRepresentingNumbers(prevprev, prev); prevprev = prev; prev = result; n++; } return(n); }
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); }