Created
January 10, 2017 23:16
-
-
Save inytar/ee9cc0062a3d7279d44623f71f5317ec to your computer and use it in GitHub Desktop.
Hamming numbers solution by Ben & Pieter for 2017-01-10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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