From c3798c69078c5e4397f066dd751d30655502a2a8 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Tue, 16 Jun 2020 01:22:08 -0400 Subject: [PATCH] Updated for performance --- .../java/mattrixwv/ProjectEuler/Problems/Problem10.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/mattrixwv/ProjectEuler/Problems/Problem10.java b/src/main/java/mattrixwv/ProjectEuler/Problems/Problem10.java index 95eaa90..390d275 100644 --- a/src/main/java/mattrixwv/ProjectEuler/Problems/Problem10.java +++ b/src/main/java/mattrixwv/ProjectEuler/Problems/Problem10.java @@ -28,7 +28,7 @@ import mattrixwv.Algorithms; public class Problem10 extends Problem{ //The largest number to check for primes - private static final Long GOAL_NUMBER = 2000000L; + private static final long GOAL_NUMBER = 2000000L; public Problem10(){ super("Find the sum of all the primes below two million"); @@ -38,7 +38,7 @@ public class Problem10 extends Problem{ timer.start(); //Get the sum of all prime numbers < GOAL_NUMBER - Long sum = Algorithms.getLongSum(Algorithms.getPrimes(GOAL_NUMBER - 1L)); //Subtract 1 from the number so that it is < the number + long sum = Algorithms.getLongSum(Algorithms.getPrimes(GOAL_NUMBER - 1L)); //Subtract 1 from the number so that it is < the number //Stop the timer timer.stop(); @@ -50,5 +50,5 @@ public class Problem10 extends Problem{ /* Results: The sum of all the primes < 2000000 is 142913828922 -It took 201.347 milliseconds to solve this problem. +It took 159.610 milliseconds to solve this problem. */