-
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
7c45bcd
commit f5b8e14
Showing
7 changed files
with
55 additions
and
2 deletions.
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
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,24 @@ | ||
Java Implementation of Problem 10 | ||
================================= | ||
|
||
View source code :source:`java/src/main/java/euler/p0010.java` | ||
|
||
Includes | ||
-------- | ||
|
||
- `Primes.java <./lib/primes.html>`_ | ||
|
||
Problem Solution | ||
---------------- | ||
|
||
.. java:type:: public class p0010 implements IEuler | ||
.. java:method:: Object answer() | ||
:return: The answer to Project Euler problem 10 | ||
|
||
.. literalinclude:: ../../../java/src/main/java/euler/p0010.java | ||
:language: java | ||
:linenos: | ||
|
||
.. tags:: prime-number, java-iterator |
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,19 @@ | ||
/* | ||
Project Euler Problem 10 | ||
Problem: | ||
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. | ||
Find the sum of all the primes below two million. | ||
*/ | ||
package euler; | ||
|
||
import euler.lib.Primes; | ||
|
||
public class p0010 implements IEuler { | ||
@Override | ||
public Object answer() { | ||
return Primes.primesUntil(2000000L).takeWhile(i -> i != null).reduce(0L, Long::sum); | ||
} | ||
} |
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