primo(x) := PRIME(x) agg(x,y) := APPEND(x,[y]) f(n,r,m) := IF( n<=m , ~ f( n+1, IF( primo(n) , ~ agg(r,n) , ~ r )~ , m ) , ~ r ) primi_fra(n,m) := f(n, [ ] ,m)