You are viewing a single comment's thread. Return to all comments →
public static void diff(long n) { long sum=(n*(n+1))/2; sum*=sum; long squares=(n*(n+1)*(2*n+1))/6; System.out.println(sum-squares); }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #6: Sum square difference
You are viewing a single comment's thread. Return to all comments →