Package net.n1da.dev.euler
Class PE0049
- java.lang.Object
-
- net.n1da.dev.euler.core.Problem
-
- net.n1da.dev.euler.PE0049
-
- All Implemented Interfaces:
Solvable
public class PE0049 extends Problem
Solution for problem 49 "Prime permutations" completed on Sat, 25 Jun 2016, 14:18.- Since:
- 12.06.2016 19:42:18
- Author:
- Nico Danneberg
- See Also:
- Problem @ Project Euler, Solution @ Ni-Da-Net
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<LargeNumber>
candidates
Memory for primes less than 1000 stored asLargeNumber
.
-
Method Summary
Modifier and Type Method Description void
prepare()
Within the preparation of this problem allcandidates
less than 1000 are collected using aSieve
.java.lang.String
solve()
This method solves the given problem by checking everycandidate
if it is a permutation of one other candidate.-
Methods inherited from class net.n1da.dev.euler.core.Problem
finish, getResult, getRuntime, toString
-
-
-
-
Field Detail
-
candidates
private java.util.ArrayList<LargeNumber> candidates
Memory for primes less than 1000 stored asLargeNumber
.- See Also:
LargeNumber
-
-
Method Detail
-
prepare
public void prepare()
Within the preparation of this problem allcandidates
less than 1000 are collected using aSieve
. The found candidates are saved aslarge numbers
.
-
solve
public java.lang.String solve()
This method solves the given problem by checking everycandidate
if it is a permutation of one other candidate. All permutations are stored in a list. Afterwards every list is checked if there are elements that have the same distance between each other.- Returns:
- the second 3-element-list as concatinated string
- See Also:
LargeNumber.isPermutationOf(LargeNumber)
-
-