".."(a, b) := makelist(i, i, a, b)$ infix("..")$ perfectp(n) := is(divsum(n) = 2*n)$ sublist(1 .. 10000, perfectp); /* [6, 28, 496, 8128] */