/* Predicate functions that checks wether an integer is a Duffinian number or not */ duffinianp(n):=if n#1 and not primep(n) and gcd(n,divsum(n))=1 then true$ /* Function that returns a list of the first len Duffinian numbers */ duffinian_count(len):=block( [i:1,count:0,result:[]], while count