Skip to main content
Commonmark migration
Source Link

#JavaScript (ES6), 42 bytes

JavaScript (ES6), 42 bytes

A port of xnor's solution.

0-indexed.

f=(n,k=2)=>n<3||k<n&&f(k)*f(n+~++k)+f(n,k)

Try it online!


#JavaScript (ES6),  83  75 bytes

JavaScript (ES6),  83  75 bytes

A faster, less recursive, but significantly longer solution.

0-indexed.

f=(n,i,a=[p=1])=>a[n]||f(n,-~i,[...a,p+=(h=k=>k<i&&a[k]*a[i-++k]+h(k))(2)])

Try it online!

#JavaScript (ES6), 42 bytes

A port of xnor's solution.

0-indexed.

f=(n,k=2)=>n<3||k<n&&f(k)*f(n+~++k)+f(n,k)

Try it online!


#JavaScript (ES6),  83  75 bytes

A faster, less recursive, but significantly longer solution.

0-indexed.

f=(n,i,a=[p=1])=>a[n]||f(n,-~i,[...a,p+=(h=k=>k<i&&a[k]*a[i-++k]+h(k))(2)])

Try it online!

JavaScript (ES6), 42 bytes

A port of xnor's solution.

0-indexed.

f=(n,k=2)=>n<3||k<n&&f(k)*f(n+~++k)+f(n,k)

Try it online!


JavaScript (ES6),  83  75 bytes

A faster, less recursive, but significantly longer solution.

0-indexed.

f=(n,i,a=[p=1])=>a[n]||f(n,-~i,[...a,p+=(h=k=>k<i&&a[k]*a[i-++k]+h(k))(2)])

Try it online!

ported xnor's solution
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649

#JavaScript (ES6), 5142 bytes

A port of ovs' solutionxnor's solution.

0-indexed.

f=(n,k=2)=>n<4?1:n-k<2?f(n-1):f=>n<3||k<n&&f(k)*f(n+~++k)+f(n,k)

Try it online!Try it online!


#JavaScript (ES6),  83  75 bytes

A faster, less recursive, but significantly longer solution.

0-indexed.

f=(n,i,a=[p=1])=>a[n]||f(n,-~i,[...a,p+=(h=k=>k<i&&a[k]*a[i-++k]+h(k))(2)])

Try it online!

#JavaScript (ES6), 51 bytes

A port of ovs' solution.

0-indexed.

f=(n,k=2)=>n<4?1:n-k<2?f(n-1):f(k)*f(n+~++k)+f(n,k)

Try it online!


#JavaScript (ES6),  83  75 bytes

A faster, less recursive, but significantly longer solution.

0-indexed.

f=(n,i,a=[p=1])=>a[n]||f(n,-~i,[...a,p+=(h=k=>k<i&&a[k]*a[i-++k]+h(k))(2)])

Try it online!

#JavaScript (ES6), 42 bytes

A port of xnor's solution.

0-indexed.

f=(n,k=2)=>n<3||k<n&&f(k)*f(n+~++k)+f(n,k)

Try it online!


#JavaScript (ES6),  83  75 bytes

A faster, less recursive, but significantly longer solution.

0-indexed.

f=(n,i,a=[p=1])=>a[n]||f(n,-~i,[...a,p+=(h=k=>k<i&&a[k]*a[i-++k]+h(k))(2)])

Try it online!

added a shorter version
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649

#JavaScript (ES6), 51 bytes

A port of ovs' solution.

0-indexed.

f=(n,k=2)=>n<4?1:n-k<2?f(n-1):f(k)*f(n+~++k)+f(n,k)

Try it online!


#JavaScript (ES6),  83  75 bytes

A faster, less recursive, but significantly longer solution.

0-indexed.

f=(n,i,a=[p=1])=>a[n]||f(n,-~i,[...a,p+=(h=k=>k<i&&a[k]*a[i-++k]+h(k))(2)])

Try it online!

#JavaScript (ES6),  83  75 bytes

0-indexed.

f=(n,i,a=[p=1])=>a[n]||f(n,-~i,[...a,p+=(h=k=>k<i&&a[k]*a[i-++k]+h(k))(2)])

Try it online!

#JavaScript (ES6), 51 bytes

A port of ovs' solution.

0-indexed.

f=(n,k=2)=>n<4?1:n-k<2?f(n-1):f(k)*f(n+~++k)+f(n,k)

Try it online!


#JavaScript (ES6),  83  75 bytes

A faster, less recursive, but significantly longer solution.

0-indexed.

f=(n,i,a=[p=1])=>a[n]||f(n,-~i,[...a,p+=(h=k=>k<i&&a[k]*a[i-++k]+h(k))(2)])

Try it online!

saved 8 bytes
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649
Loading
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649
Loading