Created
September 18, 2016 18:31
-
-
Save maxdeliso/fef3ad7302a35f830c00848630fdc834 to your computer and use it in GitHub Desktop.
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
""" https://en.wikipedia.org/wiki/Golomb_sequence """ | |
def golomb(n): | |
d = [1] | |
for i in range(0, n - 1): | |
next_val = d[len(d) - 1] + 1 | |
d.append(next_val) | |
for j in range(0, d[next_val - 1] - 1): | |
d.append(next_val) | |
return d |
Author
maxdeliso
commented
Sep 18, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment