Package net.n1da.dev.euler
Class PE0027
- java.lang.Object
-
- net.n1da.dev.euler.core.Problem
-
- net.n1da.dev.euler.PE0027
-
- All Implemented Interfaces:
Solvable
public class PE0027 extends Problem
Solution for problem 27 "Quadratic primes" completed on Thu, 23 Jul 2015, 23:58.- Since:
- 20.07.2015 23:12:27
- Author:
- Nico Danneberg
- See Also:
- Problem @ Project Euler, Solution @ Ni-Da-Net
-
-
Method Summary
-
Methods inherited from class net.n1da.dev.euler.core.Problem
finish, getResult, getRuntime, toString
-
-
-
-
Method Detail
-
prepare
public void prepare()
-
solve
public java.lang.String solve()
This method solves the given problem by running three nested loops. The outer loop steps over all primes and set them as b. A second loop increments a from 1-b to 999. A the inner loop uses the variable n starting by 0 to find the maximum number of primes in a row. Every calculated result isis checked to be a prime
or can be found oncache
.- Returns:
- the product of a and b with the maximum n
- See Also:
Mathe.isPrime(int)
-
-