Project Euler – Problem 23

Problem 23: Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.

class runner
{
	private static boolean isAbundant(int n){
		int sum = 1;
		for(int i = 2; i<=Math.sqrt(n); i++){
			if(n % i == 0){
				sum += i;
				
				int div = n/i;
				if(div != i){
					sum += div;
				}
			}
		}
		if(sum > n) return true;
		return false;
	}


	public static void main (String[] args) throws java.lang.Exception
	{
		final int max_limit = 28123;
		long time = System.currentTimeMillis();
		boolean[] arr = new boolean[max_limit+1];
		
		for(int i = 1; i <= max_limit; i++){
			if(isAbundant(i)){
				arr[i] = true;
			}
		}

		int sum = 0;
		for(int i=1;i <= max_limit; i++){
			boolean match = true;
			for(int z=12; z