@@ -0,0 +1,777 @@
+import java.util.*;%0A%0Apublic class highly_divisible_triangular %7B%0A%09public static void main(String%5B%5D args) %7B%0A%09%09int curVal=0,curAdd=0;%0A%09%09boolean found=false;%0A%0A%09%09while (curVal %3E= 0 && !found) %7B //overflow protection%0A%09%09%09curAdd++;%0A%09%09%09curVal+=curAdd;%0A%09%09%09System.out.println(curVal+%22 %22+getFactors(curVal));%0A%09%09%09if (getFactors(curVal) %3E= 500) %7B%0A%09%09%09%09found = true;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09System.out.println(curVal);%0A%09%7D%0A%0A%09public static int getFactors(int in) %7B%0A%09%09ArrayList%3CInteger%3E factors = new ArrayList%3CInteger%3E();%0A%09%09int limit = (int)Math.ceil(Math.sqrt(in));%0A%09%09for (int i=1; i%3C=limit; i++) %7B%0A%09%09%09if (in %25 i == 0) %7B%0A%09%09%09%09factors.add(new Integer(i));%0A%09%09%09%09factors.add(new Integer(in/i));%0A%09%09%09%7D%0A%09%09%7D%0A%09%09Set list = new HashSet(factors);%0A%09%09factors = new ArrayList%3CInteger%3E(list);%0A%09%09return factors.size();%0A%09%7D%0A%7D%0A

highly divisible triangular: java