Skip to main content
3 of 6
changed Total to Tr
DanTheMan
  • 4.1k
  • 17
  • 41

Wolfram Language (Mathematica), 56 49 46 bytes

f[n_,a_]=If[n<=0,Boole[n==0],Tr[f[n-#,a]&/@a]] 

Try it online!

This borrows the method used by Arnauld's answer.

Initial solution:

Length[Join@@Permutations/@IntegerPartitions[#,∞,#2]]& 

Try it online!

DanTheMan
  • 4.1k
  • 17
  • 41