How many unique ways are there to achieve a score in Football?
Mathematica - 42

Length@IntegerPartitions[#,∞,{2,3,6,7,8}]&amp;


Prolog - 140

Never wrote anything in Prolog before, just knew that this problem should be quite nice for it.

p(0,_,[]).
p(N,[H|T],O):- N&gt;=H,p(N,T,O). 
p(N,[H|S],[H|T]):- N&gt;=H,M is N-H,p(M,[H|S],T).
f(N,C):- aggregate(count,X^p(N,[2,3,6,7,8],X),C).

?- f(9,C).
C = 4.