Skip to content
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

Project Euler problems 06, 20 #1419

Merged
merged 2 commits into from
Oct 22, 2019
Merged

Project Euler problems 06, 20 #1419

merged 2 commits into from
Oct 22, 2019

Conversation

chttrjeankr
Copy link
Contributor

@chttrjeankr chttrjeankr commented Oct 22, 2019

Added new solutions for problem_06 and problem_20 for project_euler

@chttrjeankr chttrjeankr changed the title Project nos. 06, 20 Project Euler problems 06, 20 Oct 22, 2019
>>> solution(0)
1
"""
return sum(map(int, str(factorial(n))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sum(int(x) for x in str(factorial(0))) as discussed in CONTRIBUTING.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There already exists such an implementation using list comprehension in sol2.py
return sum([int(x) for x in str(factorial(n))])

Should I then remove my solution considering it redundant?

@cclauss cclauss merged commit 11e2207 into TheAlgorithms:master Oct 22, 2019
@chttrjeankr chttrjeankr deleted the project-euler-chttrjeankr branch October 22, 2019 17:29
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* added sol3.py for problem_20

* added sol4.py for problem_06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants