Skip to content

Instantly share code, notes, and snippets.

@risou
Created April 20, 2011 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save risou/931009 to your computer and use it in GitHub Desktop.
Save risou/931009 to your computer and use it in GitHub Desktop.
calc 4 numbers for these sum and diff.
public static void main(String[] args) {
System.out.println("start");
for (int i=13;i<100;i++) {
for (int j=12;j<i;j++) {
for (int k=11;k<j;k++) {
for (int l=10;l<k;l++) {
int[] n = new int[]{i+j, i+k, i+l, j+k, j+l, k+l, k-l, j-l, j-k, i-l, i-k, i-j};
Arrays.sort(n);
int[] a = new int[]{4, 8, 12, 24, 32, 36, 54, 62, 66, 86, 90, 98};
if (Arrays.equals(n, a)) {
for(int m=0;m<n.length;m++) {
System.out.print(n[m] + " ");
}
System.out.print(": " + i + " " + j + " " + k + " " + l);
System.out.println();
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment