Υǥ쥯ȥκ

nHr(N,R,X) :-
    N2 is N + R - 1,
    (N2,K1),
    N1 is N - 1,
    (N1,K2),
    (R,K3),
    X is K1 // (K2 * K3).

(0,1) :- !.
(1,1) :- !.
(N,X) :- N2 is N - 1,(N2,Y),X is N * Y.