Skip to main content
added 515 characters in body
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

Python 2, 81 bytes

1-based indexing

l=[0];p=0
exec"n=0\nwhile(p^n)&(p^n)-1or n in l:n+=1\np=n;l+=p,;"*input()
print p

Try it online!


Python 2, 79 bytes

This takes a lot of time (9999 wasn't finished after running locally for 7 minutes)

l={0};p=0;n=input()
exec'p=min({p^2**k for k in range(n)}-l);l|={p};'*n
print p

Try it online!

Python 2, 81 bytes

1-based indexing

l=[0];p=0
exec"n=0\nwhile(p^n)&(p^n)-1or n in l:n+=1\np=n;l+=p,;"*input()
print p

Try it online!


Python 2, 79 bytes

l={0};p=0;n=input()
exec'p=min({p^2**k for k in range(n)}-l);l|={p};'*n
print p

Try it online!

Python 2, 81 bytes

1-based indexing

l=[0];p=0
exec"n=0\nwhile(p^n)&(p^n)-1or n in l:n+=1\np=n;l+=p,;"*input()
print p

Try it online!


Python 2, 79 bytes

This takes a lot of time (9999 wasn't finished after running locally for 7 minutes)

l={0};p=0;n=input()
exec'p=min({p^2**k for k in range(n)}-l);l|={p};'*n
print p

Try it online!

added 515 characters in body
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

Python 2, 81 bytes

1-based indexing

l=[0];p=0
exec"n=0\nwhile(p^n)&(p^n)-1or n in l:n+=1\np=n;l+=p,;"*input()
print p

Try it online!


Python 2, 79 bytes

l={0};p=0;n=input()
exec'p=min({p^2**k for k in range(n)}-l);l|={p};'*n
print p

Try it online!

Python 2, 81 bytes

1-based indexing

l=[0];p=0
exec"n=0\nwhile(p^n)&(p^n)-1or n in l:n+=1\np=n;l+=p,;"*input()
print p

Try it online!

Python 2, 81 bytes

1-based indexing

l=[0];p=0
exec"n=0\nwhile(p^n)&(p^n)-1or n in l:n+=1\np=n;l+=p,;"*input()
print p

Try it online!


Python 2, 79 bytes

l={0};p=0;n=input()
exec'p=min({p^2**k for k in range(n)}-l);l|={p};'*n
print p

Try it online!

deleted 7 characters in body
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

Python 3.8 (pre-release)Python 2, 8581 bytes

1-based indexing, really inefficient

a=lambda n,x=0:((w:=x^(n and al=[0];p=0
exec"n=0\nwhile(n-1)p^n)&(p^n)&w-1or x in[a(i)for in in range(n)])and-~a(nl:n+=1\np=n;l+=p,x+1;"*input()
print p

Try it online!Try it online!

Python 3.8 (pre-release), 85 bytes

1-based indexing, really inefficient

a=lambda n,x=0:((w:=x^(n and a(n-1)))&w-1or x in[a(i)for i in range(n)])and-~a(n,x+1)

Try it online!

Python 2, 81 bytes

1-based indexing

l=[0];p=0
exec"n=0\nwhile(p^n)&(p^n)-1or n in l:n+=1\np=n;l+=p,;"*input()
print p

Try it online!

Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161
Loading