% s1(N,SN) - given a positive non zero integer number N, SN=1+2+...+N s1(N,SN):- N < 1, print('Error in s1'), nl, fail. s1(N,SN):- N=:=1, SN is 1. s1(N,SN):- N > 1, N1 is N-1, s1(N1, SN1), SN is SN1 + N.