Skip to main content
4 of 4
Commonmark migration

JavaScript (ES6), 21 bytes

Takes input as (k)(n).

k=>g=n=>n<1||n*g(n-k) 

Try it online!

Or 24 bytes to support BigInts.


JavaScript (ES6), 55 bytes

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

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

Try it online!

Arnauld
  • 205.5k
  • 21
  • 187
  • 670