/* Predicate function that checks wether an integer is a Giuga number or not */ giugap(n):=if not primep(n) then block(ifactors(n),map(lambda([x],mod((n/x)-1,x)=0),map(first,%%)), if length(unique(%%))=1 and apply(lhs,unique(%%))=0 then true)$ /* Function that returns a list of the first len Giuga integers */ giuga_count(len):=block( [i:1,count:0,result:[]], while count