-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93ceb27
commit c7c3c22
Showing
5 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
JavaScript Implementation of Problem 10 | ||
======================================= | ||
|
||
View source code :source:`javascript/src/p0010.js` | ||
|
||
Includes | ||
-------- | ||
|
||
- `primes <./primes.html>`_ | ||
|
||
Problem Solution | ||
---------------- | ||
|
||
.. js:autofunction:: p0010 | ||
|
||
.. literalinclude:: ../../javascript/src/p0010.js | ||
:language: javascript | ||
:linenos: |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Project Euler Problem 10 | ||
* | ||
* Yet again, having a good prime number infrastructure comes in handy | ||
* | ||
* Problem: | ||
* | ||
* The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. | ||
* | ||
* Find the sum of all the primes below two million. | ||
* | ||
* @return {number} | ||
*/ | ||
exports.p0010 = function() { | ||
let answer = 0; | ||
for (p of primes.primes(2000000)) { | ||
answer += p; | ||
} | ||
return answer; | ||
}; | ||
|
||
const primes = require('./lib/primes.js'); |