Skip to content

Instantly share code, notes, and snippets.

@ConnorBaker
Created November 3, 2019 01:06
Show Gist options
  • Select an option

  • Save ConnorBaker/1aed102e3d08385bbe67343ce38b7bc6 to your computer and use it in GitHub Desktop.

Select an option

Save ConnorBaker/1aed102e3d08385bbe67343ce38b7bc6 to your computer and use it in GitHub Desktop.
public static List<Long> binaryNialpdromes(int n) {
final var ret = new ArrayList<Long>(n*(n+1)/2);
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
ret.add((long) (Math.pow(2.0, i) - Math.pow(2.0, j)));
}
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment