Created
April 22, 2021 23:23
-
-
Save naxmefy/03cac14772081fcf62bb2c9fdfd96047 to your computer and use it in GitHub Desktop.
Print n terms of Conways sequence (without leading 0)
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
n=int(input()) | |
f=[0,1,1] | |
for i in range(3,n+1): | |
f.append(f[f[i - 1]] + f[i - f[i - 1]]) | |
print(*f[1:n+1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment