Skip to main content
added 67 characters in body
Source Link
nimi
  • 35.9k
  • 4
  • 34
  • 99

Haskell, 49 4343 39 bytes

a n|n<4=1|0<1=sum[an=max(sum[a k*a(n-2-k)|k<-[2..n-1]])1              

Try it online!Try it online!

For n<3 the sum is 0, so max ... 1 raises it to 1.

Edit: -6 bytes thanks to @Jo King.

Haskell, 49 43 bytes

a n|n<4=1|0<1=sum[a k*a(n-2-k)|k<-[2..n-1]]              

Try it online!

Edit: -6 bytes thanks to @Jo King.

Haskell, 49 43 39 bytes

a n=max(sum[a k*a(n-2-k)|k<-[2..n-1]])1              

Try it online!

For n<3 the sum is 0, so max ... 1 raises it to 1.

Edit: -6 bytes thanks to @Jo King.

deleted 3 characters in body
Source Link
nimi
  • 35.9k
  • 4
  • 34
  • 99

Haskell, 4949 43 bytes

a n|n<4=1|m<-n-2=a(n-1)+sum[an|n<4=1|0<1=sum[a k*a(mn-2-k)|k<-[2..m]]n-1]]              

Try it online!Try it online!

A direct implementation of the recursive formulaEdit: -6 bytes thanks to @Jo King.

Haskell, 49 bytes

a n|n<4=1|m<-n-2=a(n-1)+sum[a k*a(m-k)|k<-[2..m]]

Try it online!

A direct implementation of the recursive formula.

Haskell, 49 43 bytes

a n|n<4=1|0<1=sum[a k*a(n-2-k)|k<-[2..n-1]]              

Try it online!

Edit: -6 bytes thanks to @Jo King.

Source Link
nimi
  • 35.9k
  • 4
  • 34
  • 99

Haskell, 49 bytes

a n|n<4=1|m<-n-2=a(n-1)+sum[a k*a(m-k)|k<-[2..m]]

Try it online!

A direct implementation of the recursive formula.