public static long GetSolutionOfProblem34() { // An easy upper bound is 10 000 000, but the computation shows they are all below 50 000. var upperBound = 50000; var listOfNumbersThatCanBeWrittenAsSumOfFactorialsOfDigits = Enumerable.Range(3, upperBound) .Where(number => FactorialHelper.IsSumOfFactorialOfDigits(number)); return(listOfNumbersThatCanBeWrittenAsSumOfFactorialsOfDigits.Sum()); }
public static BigInteger NumberOfPermutations(string number) { var numberOfPermutations = FactorialHelper.Factorial(number.Length); var distinctCharacters = number.Distinct(); foreach (char distinctCharacter in distinctCharacters) { var numberOfTimesInNumber = number.Where(character => character == distinctCharacter).Count(); numberOfPermutations /= FactorialHelper.Factorial(numberOfTimesInNumber); } return(numberOfPermutations); }
public static long GetSolutionOfProblem53() { var max = 100; return(FactorialHelper.NumberOfCombinatoricSelectionsExceedingOneMillion(max)); }