A solution to the factorial problem using JEOPS.
The rule base file:
FactBase.rules