Skip to content

Instantly share code, notes, and snippets.

@inytar
Created January 10, 2017 23:16
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 inytar/ee9cc0062a3d7279d44623f71f5317ec to your computer and use it in GitHub Desktop.
Save inytar/ee9cc0062a3d7279d44623f71f5317ec to your computer and use it in GitHub Desktop.
Hamming numbers solution by Ben & Pieter for 2017-01-10
data = []
def hamming(n):
return data[n - 1]
def calc_hamming(i, j, k):
return 2**i * 3**j * 5**k
for i in range(50):
for j in range(50):
for k in range(50):
data.append(calc_hamming(i, j, k))
data = sorted(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment