Created
July 22, 2015 14:43
-
-
Save vlofgren/7d99b095d2714a578da0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // end range is the first number that shouldn't be included (to be in line with problem formulation) | |
| constexpr int projecteuler1(int endRange) { | |
| return (3*((endRange-1)/3)*((endRange-1)/3+1) | |
| + 5*((endRange-1)/5)*((endRange-1)/5+1) | |
| - 15*((endRange-1)/15)*((endRange-1)/15+1))/2; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment