Skip to content

Instantly share code, notes, and snippets.

@juanplopes
Created January 16, 2015 23:38
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 juanplopes/aabf64c52d87d3adc933 to your computer and use it in GitHub Desktop.
Save juanplopes/aabf64c52d87d3adc933 to your computer and use it in GitHub Desktop.
import math
def f(i, n):
if i==0: return 0
if i==1: return n/2
if i%2==0:
return f(i/2, n)-f(int(math.log(i)/math.log(2)), n)/2
else:
return f(i/2, n)+f(int(math.log(i)/math.log(2)), n)/2
print len(set(f(x, 360) for x in range(360)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment