Skip to main content
added 2 characters in body
Source Link
isaacg
  • 7.8k
  • 2
  • 21
  • 57

I wrote a straightforward depth-first-search program, and found a sequence of length

129

namely

ULDUDRUDULDDURURLLDUDRLURLDDURDLURLURLDRULRDDRLLRLUUDRULRRLDDUURDLULRRLDRLLRLRDLURLURDLURLDDRUURLDDUULRLRRLDRDLUDUUDUDDRUULLDRUDL

This took about five minutes to find. I don't see any obvious pattern to extend this indefinitely. I'll leave the program running, and see what shows up.

Here's the program:

translate = {
        (0, 1): "R",
        (1, 0): "U",
        (0, -1): "L",
        (-1, 0): "D",
        }

c = [0]
v = [(1, 0), (0, -1), (-1, 0), (0, 1)]
m = 0
while c:
    succeed = True
    for div in range(1, len(c)):
        up = 0
        right = 0
        for off in range(len(c)//div):
            up += v[c[off*div+div-1]][0]
            right += v[c[off*div+div-1]][1]
            if up < -1 or up > 1 or right < -1 or right > 1:
                succeed = False
                break
        if not succeed:
            break
    if succeed:
        if len(c) > m:
            m = len(c)
            print(m, ''.join(translate[v[i]] for i in c))
        c.append(0)
    else:
        while c[-1] == 3:
            c.pop()
        c[-1] += 1

I wrote a straightforward depth-first-search program, and found a sequence of length

129

namely

ULDUDRUDULDDURURLLDUDRLURLDDURDLURLURLDRULRDDRLLRLUUDRULRRLDDUURDLULRRLDRLLRLRDLURLURDLURLDDRUURLDDUULRLRRLDRDLUDUUDUDDRUULLDRUDL

This took about five minutes to find. I don't see any obvious pattern to extend this indefinitely. I'll leave the program running, and see what shows up.

Here's the program:

v = [(1, 0), (0, -1), (-1, 0), (0, 1)]
m = 0
while c:
    succeed = True
    for div in range(1, len(c)):
        up = 0
        right = 0
        for off in range(len(c)//div):
            up += v[c[off*div+div-1]][0]
            right += v[c[off*div+div-1]][1]
            if up < -1 or up > 1 or right < -1 or right > 1:
                succeed = False
                break
        if not succeed:
            break
    if succeed:
        if len(c) > m:
            m = len(c)
            print(m, ''.join(translate[v[i]] for i in c))
        c.append(0)
    else:
        while c[-1] == 3:
            c.pop()
        c[-1] += 1

I wrote a straightforward depth-first-search program, and found a sequence of length

129

namely

ULDUDRUDULDDURURLLDUDRLURLDDURDLURLURLDRULRDDRLLRLUUDRULRRLDDUURDLULRRLDRLLRLRDLURLURDLURLDDRUURLDDUULRLRRLDRDLUDUUDUDDRUULLDRUDL

This took about five minutes to find. I don't see any obvious pattern to extend this indefinitely. I'll leave the program running, and see what shows up.

Here's the program:

translate = {
        (0, 1): "R",
        (1, 0): "U",
        (0, -1): "L",
        (-1, 0): "D",
        }

c = [0]
v = [(1, 0), (0, -1), (-1, 0), (0, 1)]
m = 0
while c:
    succeed = True
    for div in range(1, len(c)):
        up = 0
        right = 0
        for off in range(len(c)//div):
            up += v[c[off*div+div-1]][0]
            right += v[c[off*div+div-1]][1]
            if up < -1 or up > 1 or right < -1 or right > 1:
                succeed = False
                break
        if not succeed:
            break
    if succeed:
        if len(c) > m:
            m = len(c)
            print(m, ''.join(translate[v[i]] for i in c))
        c.append(0)
    else:
        while c[-1] == 3:
            c.pop()
        c[-1] += 1
added 4 characters in body
Source Link
isaacg
  • 7.8k
  • 2
  • 21
  • 57

I wrote a straightforward depth-first-search program, and found a sequence of length

129

namely

ULDUDRUDULDDURURLLDUDRLURLDDURDLURLURLDRULRDDRLLRLUUDRULRRLDDUURDLULRRLDRLLRLRDLURLURDLURLDDRUURLDDUULRLRRLDRDLUDUUDUDDRUULLDRUDL

This took about a minutefive minutes to find. I don't see any obvious pattern to extend this indefinitely. I'll leave the program running, and see what shows up.

Here's the program:

v = [(1, 0), (0, -1), (-1, 0), (0, 1)]
m = 0
while c:
    succeed = True
    for div in range(1, len(c)):
        up = 0
        right = 0
        for off in range(len(c)//div):
            up += v[c[off*div+div-1]][0]
            right += v[c[off*div+div-1]][1]
            if up < -1 or up > 1 or right < -1 or right > 1:
                succeed = False
                break
        if not succeed:
            break
    if succeed:
        if len(c) > m:
            m = len(c)
            print(m, ''.join(translate[v[i]] for i in c))
        c.append(0)
    else:
        while c[-1] == 3:
            c.pop()
        c[-1] += 1

I wrote a straightforward depth-first-search program, and found a sequence of length

129

namely

ULDUDRUDULDDURURLLDUDRLURLDDURDLURLURLDRULRDDRLLRLUUDRULRRLDDUURDLULRRLDRLLRLRDLURLURDLURLDDRUURLDDUULRLRRLDRDLUDUUDUDDRUULLDRUDL

This took about a minute to find. I don't see any obvious pattern to extend this indefinitely. I'll leave the program running, and see what shows up.

Here's the program:

v = [(1, 0), (0, -1), (-1, 0), (0, 1)]
m = 0
while c:
    succeed = True
    for div in range(1, len(c)):
        up = 0
        right = 0
        for off in range(len(c)//div):
            up += v[c[off*div+div-1]][0]
            right += v[c[off*div+div-1]][1]
            if up < -1 or up > 1 or right < -1 or right > 1:
                succeed = False
                break
        if not succeed:
            break
    if succeed:
        if len(c) > m:
            m = len(c)
            print(m, ''.join(translate[v[i]] for i in c))
        c.append(0)
    else:
        while c[-1] == 3:
            c.pop()
        c[-1] += 1

I wrote a straightforward depth-first-search program, and found a sequence of length

129

namely

ULDUDRUDULDDURURLLDUDRLURLDDURDLURLURLDRULRDDRLLRLUUDRULRRLDDUURDLULRRLDRLLRLRDLURLURDLURLDDRUURLDDUULRLRRLDRDLUDUUDUDDRUULLDRUDL

This took about five minutes to find. I don't see any obvious pattern to extend this indefinitely. I'll leave the program running, and see what shows up.

Here's the program:

v = [(1, 0), (0, -1), (-1, 0), (0, 1)]
m = 0
while c:
    succeed = True
    for div in range(1, len(c)):
        up = 0
        right = 0
        for off in range(len(c)//div):
            up += v[c[off*div+div-1]][0]
            right += v[c[off*div+div-1]][1]
            if up < -1 or up > 1 or right < -1 or right > 1:
                succeed = False
                break
        if not succeed:
            break
    if succeed:
        if len(c) > m:
            m = len(c)
            print(m, ''.join(translate[v[i]] for i in c))
        c.append(0)
    else:
        while c[-1] == 3:
            c.pop()
        c[-1] += 1
Source Link
isaacg
  • 7.8k
  • 2
  • 21
  • 57

I wrote a straightforward depth-first-search program, and found a sequence of length

129

namely

ULDUDRUDULDDURURLLDUDRLURLDDURDLURLURLDRULRDDRLLRLUUDRULRRLDDUURDLULRRLDRLLRLRDLURLURDLURLDDRUURLDDUULRLRRLDRDLUDUUDUDDRUULLDRUDL

This took about a minute to find. I don't see any obvious pattern to extend this indefinitely. I'll leave the program running, and see what shows up.

Here's the program:

v = [(1, 0), (0, -1), (-1, 0), (0, 1)]
m = 0
while c:
    succeed = True
    for div in range(1, len(c)):
        up = 0
        right = 0
        for off in range(len(c)//div):
            up += v[c[off*div+div-1]][0]
            right += v[c[off*div+div-1]][1]
            if up < -1 or up > 1 or right < -1 or right > 1:
                succeed = False
                break
        if not succeed:
            break
    if succeed:
        if len(c) > m:
            m = len(c)
            print(m, ''.join(translate[v[i]] for i in c))
        c.append(0)
    else:
        while c[-1] == 3:
            c.pop()
        c[-1] += 1