Created
August 13, 2018 17:54
-
-
Save JKirchartz/88894690bb2f96ddd995c920b45f1733 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
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim:fenc=utf-8 | |
# Ely Golden, Jun 14 2018 | |
def recaman(n): | |
seq = [] | |
for i in range(n): | |
if(i == 0): x = 0 | |
else: x = seq[i-1]-i | |
if(x>=0 and x not in seq): seq+=[x] | |
else: seq+=[seq[i-1]+i] | |
return seq | |
print(recaman(100000000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment