Skip to main content
1 of 5
Soham Chowdhury
  • 1.6k
  • 1
  • 14
  • 23

Python, 78 (I smell shortening!)

def f(x):
  a=f(x-1);return(a-x,a+x)[a-x in map(f,range(x)) or a>x]
  return 0
Soham Chowdhury
  • 1.6k
  • 1
  • 14
  • 23