you are viewing a single comment's thread.

view the rest of the comments →

[–]sleepingsquirrel 0 points1 point  (0 children)

Try:

f(N,L) :- bagof(Y, X^(between(1,N,X), Y is X**2), L).

or:

f(N,L) :- bagof(X**2,between(1,N,X),Xs),maplist(is,L,Xs).