Skip to content

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