Skip to content

Instantly share code, notes, and snippets.

@Bejofo
Created July 12, 2023 16:39
Show Gist options
  • Save Bejofo/e8cc8b2a2224d95f006261b4d6d3dbf6 to your computer and use it in GitHub Desktop.
Save Bejofo/e8cc8b2a2224d95f006261b4d6d3dbf6 to your computer and use it in GitHub Desktop.
# Find the sum of all 64-bit ints with hamming weight 3.
import math;x,y=64,3;math.comb(x-1,y-1)*(2**x-1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment