Пример #1
0
 private static long SumOfAmicableNumbersUnder(int ceiling) =>
 StrangeEnumerable.Range(1, ceiling)
 .Where(a =>
 {
     long b = a.GetFactorsNotIncluding().Sum();
     return(a.IsAmicablePairOf(b));
 })
 .Sum();
Пример #2
0
 private static long LongestCollatzSequenceUnder(int ceiling) =>
 StrangeEnumerable.Range(1, ceiling)
 .OrderByDescending(n => n.CollatzSequenceLength())
 .FirstOrDefault();
Пример #3
0
 private static long SumOfNumbersNotSumOfTwoAbundantNumbers(int ceiling, IEnumerable <long> sumsOfTwoAbundantNumbers) =>
 StrangeEnumerable.Range(1, ceiling)
 .Except(sumsOfTwoAbundantNumbers)
 .Sum();
Пример #4
0
 private static List <long> AbundantNumbersUnder(int count) =>
 StrangeEnumerable.Range(1, count).Where(n => n.IsAbundant()).ToList();