Package net.n1da.dev.euler
Class PE0060
- java.lang.Object
-
- net.n1da.dev.euler.core.Problem
-
- net.n1da.dev.euler.PE0060
-
- All Implemented Interfaces:
Solvable
public class PE0060 extends Problem
Solution for problem 60 "Prime pair sets" completed on Tue, 1 May 2018, 13:41.- Since:
- 01.05.2018 07:53: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<java.lang.Integer>
candidates
-
Method Summary
Modifier and Type Method Description void
prepare()
All primes between 2 and 10.000 are stored ascandidates
using aSieve
.java.lang.String
solve()
Solves this problem by run five nested loops but every inner loop is shorter than the outer.private boolean
testPrimePairs(java.lang.String... arr)
Tests if all given strings create new primes by concatenating them pairwise in both directions.-
Methods inherited from class net.n1da.dev.euler.core.Problem
finish, getResult, getRuntime, toString
-
-
-
-
Method Detail
-
prepare
public void prepare()
All primes between 2 and 10.000 are stored ascandidates
using aSieve
.
-
solve
public java.lang.String solve()
Solves this problem by run five nested loops but every inner loop is shorter than the outer.- Returns:
- the sum of the first five primes that matches the condition
-
testPrimePairs
private boolean testPrimePairs(java.lang.String... arr)
Tests if all given strings create new primes by concatenating them pairwise in both directions.- Parameters:
arr
- an array ofstrings
- Returns:
- true if all strings in the array create primes pairwise
-
-