Skip to main content
1 of 4
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

#JavaScript (ES6), 25 bytes

Takes input as (k)(n).

k=>g=n=>n>k?n*g(n-k):n|!n 

Try it online!

Or 26 bytes to support BigInts.


#JavaScript (ES6), 59 bytes

Takes input as a string, using the format described in the challenge.

s=>(a=s.split`!`,k=a.length,g=n=>n*=n<k||g(n-k+1))(a[0])||1 

Try it online!

Arnauld
  • 205.5k
  • 21
  • 187
  • 670