fork download
  1. prdel(1,[],_).
  2.  
  3. prdel(P,[D|L],D):-
  4. 0 is mod(P,D),
  5. P1 is P/D,
  6. prdel(P1,L,D).
  7.  
  8. prdel(P,L,D):-
  9. mod(P,D) > 0,
  10. D1 is D+1,
  11. D1 =< P,
  12. prdel(P,L,D1).
  13.  
  14. :- findall(X, prdel(72, X, 2), LIST), write(LIST).
Success #stdin #stdout #stderr 0.02s 6160KB
stdin
Standard input is empty
stdout
[[2, 2, 2, 3, 3]]
stderr