Skip to main content
Commonmark migration
Source Link

#Python 2, 117 bytes

Python 2, 117 bytes

Meh. Not that short. The simple iterative solution.

L=[1,2,3]
n=input()
while len(L)<n:
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break
print L[n-1]

Try it online

Here's a really bad attempt at a recursive solution (129 bytes):

def f(n,L=[1,2,3]):
 if len(L)>=n:print L[n-1];exit(0)
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:f(n,L+[i])
 f(n,L)

#Python 2, 117 bytes

Meh. Not that short. The simple iterative solution.

L=[1,2,3]
n=input()
while len(L)<n:
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break
print L[n-1]

Try it online

Here's a really bad attempt at a recursive solution (129 bytes):

def f(n,L=[1,2,3]):
 if len(L)>=n:print L[n-1];exit(0)
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:f(n,L+[i])
 f(n,L)

Python 2, 117 bytes

Meh. Not that short. The simple iterative solution.

L=[1,2,3]
n=input()
while len(L)<n:
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break
print L[n-1]

Try it online

Here's a really bad attempt at a recursive solution (129 bytes):

def f(n,L=[1,2,3]):
 if len(L)>=n:print L[n-1];exit(0)
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:f(n,L+[i])
 f(n,L)
added 2 characters in body
Source Link
mbomb007
  • 23.5k
  • 7
  • 63
  • 135

#Python 2, 116117 bytes

Meh. Not that short. The simple iterative solution.

L=[1,2,3]
n=input()
while len(L)<n:
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break
print L[L[n-1]

Try it onlineTry it online

Here's a really bad attempt at a recursive solution (128129 bytes):

def f(n,L=[1,2,3]):
 if len(L)>=n:print L[L[n-1];exit(0)
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:f(n,L+[i])
 f(n,L)

#Python 2, 116 bytes

Meh. Not that short. The simple iterative solution.

L=[1,2,3]
n=input()
while len(L)<n:
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break
print L[-1]

Try it online

Here's a really bad attempt at a recursive solution (128 bytes):

def f(n,L=[1,2,3]):
 if len(L)>=n:print L[-1];exit(0)
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:f(n,L+[i])
 f(n,L)

#Python 2, 117 bytes

Meh. Not that short. The simple iterative solution.

L=[1,2,3]
n=input()
while len(L)<n:
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break
print L[n-1]

Try it online

Here's a really bad attempt at a recursive solution (129 bytes):

def f(n,L=[1,2,3]):
 if len(L)>=n:print L[n-1];exit(0)
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:f(n,L+[i])
 f(n,L)
added 228 characters in body
Source Link
mbomb007
  • 23.5k
  • 7
  • 63
  • 135

#Python 2, 116 bytes

Meh. Not that short. The simple iterative solution.

  
L=[1,2,3]
n=input()
while len(L)<n:
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break
print L[-1]

Try it online

Here's a really bad attempt at a recursive solution (128 bytes):

def f(n,L=[1,2,3]):
 if len(L)>=n:print L[-1];exit(0)
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:f(n,L+[i])
 f(n,L)

#Python 2, 116 bytes

Meh. Not that short. The simple iterative solution.

 
L=[1,2,3]
n=input()
while len(L)<n:
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break
print L[-1]

Try it online

#Python 2, 116 bytes

Meh. Not that short. The simple iterative solution.

 
L=[1,2,3]
n=input()
while len(L)<n:
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:L+=[i];break
print L[-1]

Try it online

Here's a really bad attempt at a recursive solution (128 bytes):

def f(n,L=[1,2,3]):
 if len(L)>=n:print L[-1];exit(0)
 for i in range(2,n):
    if L.count(i)<L[i-1]and L[-1]!=i:f(n,L+[i])
 f(n,L)
Source Link
mbomb007
  • 23.5k
  • 7
  • 63
  • 135
Loading