%fun( +X, +I, +N, -Y ) fun(X,N,N,1). fun(X,I,N,Y):- I1 is I+1, I