OFFSET
1,1
COMMENTS
Starting from [-1,0] taking 2*n steps of length 1/n each either up or right, follow the path staying as close to the unit circle as possible. Every step up is considered a 1, every step right is considered a 0.
EXAMPLE
For n=3, we have 110100, meaning if we were to start at [-1, 0] and take 2*n=6 steps of length 1/n = 1/6 which can either be up or to the right, to follow the path of the unit circle the closest we would move up 1, up 1 again, then right, then up again, then right two more times, which we translate to the binary number 110100.
PROG
(Python)
def closer(pos1, pos2):
dpos1 = (pos1[0]**2.0+pos1[1]**2.0)**.5
dpos2 = (pos2[0]**2.0+pos2[1]**2.0)**.5
if (1.0-dpos1)**2.0 < (1.0-dpos2)**2.0:
return True
else:
return False
def converts(path):
return ''.join(path)
l = []
for steps in range(1, 20):
stepsize = 1.0/steps
pos = [-1.0, 0.0]
paths = []
for i in range(0, 2*steps):
if closer([pos[0]+stepsize, pos[1]], [pos[0], pos[1]+stepsize]):
pos = [pos[0]+stepsize, pos[1]]
paths.append(str(0))
else:
pos = [pos[0], pos[1]+stepsize]
paths.append(str(1))
l.append(int(converts(paths)))
print(l)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ben Paul Thurston, May 06 2018
STATUS
approved