Skip to main content
deleted 8 characters in body
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119

Julia, 2823 bytes

n->Int(binomial>binomial(2n,n)/(n+1))

This is an anonymous function that accepts an integer and returns an integera float. It uses the basic binomial formula. To call it, give it a name, e.g. f=n->....

Julia, 28 bytes

n->Int(binomial(2n,n)/(n+1))

This is an anonymous function that accepts an integer and returns an integer. It uses the basic binomial formula. To call it, give it a name, e.g. f=n->....

Julia, 23 bytes

n->binomial(2n,n)/(n+1)

This is an anonymous function that accepts an integer and returns a float. It uses the basic binomial formula. To call it, give it a name, e.g. f=n->....

deleted 63 characters in body
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119

Julia, 5228 bytes

print(Intn->Int(binomial(2(n=parse(readline()))2n,n)/(n+1)))

Ungolfed:This is an anonymous function that accepts an integer and returns an integer. It uses the basic binomial formula. To call it, give it a name, e.g. f=n->....

# Read n from STDIN
n = parse(readline())

# Compute the nth Catalan number
c = binomial(2n, n) / (n + 1)

# Print the number as an integer
print(Int(c))

Julia, 52 bytes

print(Int(binomial(2(n=parse(readline())),n)/(n+1)))

Ungolfed:

# Read n from STDIN
n = parse(readline())

# Compute the nth Catalan number
c = binomial(2n, n) / (n + 1)

# Print the number as an integer
print(Int(c))

Julia, 28 bytes

n->Int(binomial(2n,n)/(n+1))

This is an anonymous function that accepts an integer and returns an integer. It uses the basic binomial formula. To call it, give it a name, e.g. f=n->....

Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119

Julia, 52 bytes

print(Int(binomial(2(n=parse(readline())),n)/(n+1)))

Ungolfed:

# Read n from STDIN
n = parse(readline())

# Compute the nth Catalan number
c = binomial(2n, n) / (n + 1)

# Print the number as an integer
print(Int(c))