Skip to content

Add problem 42 solution #1259

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

Merged
merged 1 commit into from
Oct 3, 2019
Merged

Add problem 42 solution #1259

merged 1 commit into from
Oct 3, 2019

Conversation

Hyftar
Copy link
Contributor

@Hyftar Hyftar commented Oct 2, 2019

This PR adds the problem 42 solution to Project Euler's problems.

@@ -0,0 +1,44 @@
"""
The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are:
Copy link
Member

Choose a reason for hiding this comment

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

Please wrap at 88 characters max as discussed in
https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md



# Precomputes a list of the 100 first triangular numbers
TRIANGULAR_NUMBERS = set(map(lambda n: int(0.5 * n * (n + 1)), range(1, 101)))
Copy link
Member

@cclauss cclauss Oct 3, 2019

Choose a reason for hiding this comment

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

TRIANGULAR_NUMBERS = set(int(0.5 * n * (n + 1)) for n in range(1, 101)) as discussed in CONTRIBUTING.md

@cclauss cclauss merged commit 309204a into TheAlgorithms:master Oct 3, 2019
@cclauss
Copy link
Member

cclauss commented Oct 3, 2019

WELL DONE!!!

@Hyftar Hyftar deleted the problem42 branch October 3, 2019 20:53
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
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