title: Prolog: dividing a number
body: <p>I wanted to make a predicate that returns a list of a number dividers.
  Example: 72 = 2*2*2*3*3.</p>
  
  <pre><code>prdel(A,[],_):- 
        A is 1.
  prdel(P,[D|L],D):-
        0 is mod(P,D),
        P1 is P/D,
        prdel(P1,L,D).
  prdel(P,L,D):-
        D1 is D+1,
        prdel(P,L,D1).
  </code></pre>
  
  <p>This works and returns the right list. The problem is that it does not stop after that but returns the same list over and over again if I press space (I am sorry I don't know the term in English when you use the same predicate to get different answer). I want it to stop after the first time.</p>
  
  <p>I tried to edit the last one like that,</p>
  
  <pre><code>prdel(P,L,D):-
        D1 is D+1,
        D1&lt;P,
        prdel(P,L,D1).
  </code></pre>
  
  <p>but now it returns only false and not the list.</p>
  
  <p>EDIT:</p>
  
  <p>I am looking for an answer without cut.</p>