Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stirling(N, M, X) :- N < M, X is 0.
- stirling(N, N, 1).
- stirling(N, 1, 1).
- stirling(N, 0, 0) :- N > 0.
- stirling(N, M, X) :- N > M, I is N-1, J is M-1, stirling(I, J, K), stirling(I, M, L), X is K + M * L.
- petla(N, N, X) :- stirling(N, N, K), X is K.
- petla(N, I, X) :- I < N, K is I+1, stirling(N, I, J), petla(N, K, L), X is J + L.
- bell(N, X) :- petla(N, 0, K), X is K.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement