-
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
a165fe2
commit a08cec0
Showing
8 changed files
with
132 additions
and
4 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 3 | ||
================================ | ||
|
||
View source code :source:`java/src/main/java/euler/p0003.java` | ||
|
||
Includes | ||
-------- | ||
|
||
- `Primes.java <./lib/primes.html>`_ | ||
|
||
Problem Solution | ||
---------------- | ||
|
||
.. java:type:: public class p0003 implements IEuler | ||
.. java:method:: Object answer() | ||
:return: The answer to Project Euler problem 3 | ||
|
||
.. literalinclude:: ../../../java/src/main/java/euler/p0003.java | ||
:language: java | ||
:linenos: | ||
|
||
.. tags:: factorization, 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
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,25 @@ | ||
/* | ||
Project Euler Problem 3 | ||
The lesson I've taken from these is that Streams are significantly more cumbersome in Java than in other languages | ||
Problem: | ||
The prime factors of 13195 are 5, 7, 13 and 29. | ||
What is the largest prime factor of the number 600851475143 ? | ||
*/ | ||
package euler; | ||
|
||
import java.util.Comparator; | ||
|
||
import euler.lib.Primes; | ||
|
||
public class p0003 implements IEuler { | ||
@Override | ||
public Object answer() { | ||
return (short) Primes.primeFactors(600851475143L) | ||
.max(Comparator.naturalOrder()) | ||
.get(); | ||
} | ||
} |
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