Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#JavaScript (ES6), 24 bytes

Based on the Python answerPython answer.

c=x=>x?(4+6/~x)*c(x-1):1

###How it works

c=x=>x?(4+6/~x)*c(x-1):1
c=x=>                     // Define a function c that takes a parameter x and returns:
     x?               :1  //  If x == 0, 1.
       (4+6/~x)           //  Otherwise, (4 + (6 / (-x - 1)))
               *c(x-1)    //  times the previous item in the sequence.

I think this is the shortest it can get, but suggestions are welcome!

#JavaScript (ES6), 24 bytes

Based on the Python answer.

c=x=>x?(4+6/~x)*c(x-1):1

###How it works

c=x=>x?(4+6/~x)*c(x-1):1
c=x=>                     // Define a function c that takes a parameter x and returns:
     x?               :1  //  If x == 0, 1.
       (4+6/~x)           //  Otherwise, (4 + (6 / (-x - 1)))
               *c(x-1)    //  times the previous item in the sequence.

I think this is the shortest it can get, but suggestions are welcome!

#JavaScript (ES6), 24 bytes

Based on the Python answer.

c=x=>x?(4+6/~x)*c(x-1):1

###How it works

c=x=>x?(4+6/~x)*c(x-1):1
c=x=>                     // Define a function c that takes a parameter x and returns:
     x?               :1  //  If x == 0, 1.
       (4+6/~x)           //  Otherwise, (4 + (6 / (-x - 1)))
               *c(x-1)    //  times the previous item in the sequence.

I think this is the shortest it can get, but suggestions are welcome!

Source Link
ETHproductions
  • 50.1k
  • 6
  • 94
  • 240

#JavaScript (ES6), 24 bytes

Based on the Python answer.

c=x=>x?(4+6/~x)*c(x-1):1

###How it works

c=x=>x?(4+6/~x)*c(x-1):1
c=x=>                     // Define a function c that takes a parameter x and returns:
     x?               :1  //  If x == 0, 1.
       (4+6/~x)           //  Otherwise, (4 + (6 / (-x - 1)))
               *c(x-1)    //  times the previous item in the sequence.

I think this is the shortest it can get, but suggestions are welcome!