Skip to content

Instantly share code, notes, and snippets.

@JKirchartz
Created August 13, 2018 17:54
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 JKirchartz/88894690bb2f96ddd995c920b45f1733 to your computer and use it in GitHub Desktop.
Save JKirchartz/88894690bb2f96ddd995c920b45f1733 to your computer and use it in GitHub Desktop.
#! /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