Added solution for problem 35

This commit is contained in:
2021-06-06 12:19:14 -04:00
parent c80941d3fb
commit 4ee0939c58
2 changed files with 93 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
function [] = Problem34()
%ProjectEuler/ProjectEulerOctave/Problem34.lua
%Matthew Ellison
% Createe: 06-01-21
% Created: 06-01-21
%Modified: 06-01-21
%Find the sum of all numbers which are equal to the sum of the factorial of their digits
%{
@@ -22,13 +22,13 @@ function [] = Problem34()
%}
%Setup the variables
%Start the timer
startTime = clock();
MAX_NUM = 1499999; %The largest num that can be the sum of its own digits
numberFactorials = []; %Holds the pre-computed factorials of the numbers 0-9
totalSum = 0; %Holds the sum of all numbers equal to the sum of their digit's factorials
%Start the timer
startTime = clock();
%Pre-compute the possible factorials from 0! to 9!
for cnt = 1 : 9
numberFactorials(cnt) = factorial(cnt);