-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sum of factorials #101
base: master
Are you sure you want to change the base?
Sum of factorials #101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a binary file: src/bin/2
that is not required.
Your solution does not test the base case provided:
1! + 4! + 5! = 1 + 24 + 120 = 145.
. Add a test for this base case.
Also you need to solve the main question:
Find the sum of all numbers which are equal to the sum of the factorial of their digits.
…m of the factorial of their digits.
delete .rustc_info.json
@maretekent maybe we need a test for A function that takes the number e.g. The test for this function will be something like this: #[test]
fn test_factorial_sum(){
assert_eq!(factorial_sum(145), 145);
} We can extrapolate this to an algorithm for finding the sum of all these numbers:
|
Solution Number: {34.rs}
Checklist:
src/bin
What
Find the sum of all numbers which are equal to the sum of the factorial of their digits.
145 is an interesting number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Note: as 1! = 1 and 2! = 2 are not sums they are not included.
How
Solution
Nice to have:
I would have loved to iterate over the characters of string and convert and add them using fold
Challenges
You are attempting to multiply with overflow
Ref
Project Euler problem 34
Issue 34