Skip to content

Instantly share code, notes, and snippets.

@myaosato
Created February 12, 2022 04:21
Show Gist options
  • Select an option

  • Save myaosato/3d5147987e01d74b6a2af65bdaed6791 to your computer and use it in GitHub Desktop.

Select an option

Save myaosato/3d5147987e01d74b6a2af65bdaed6791 to your computer and use it in GitHub Desktop.
Factrial on Prolog
fact(1, F) :- F is 1.
fact(N, F) :-
N > 1,
M is N - 1,
fact(M, T),
F is N * T.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment