RosettaCodeData/Task/Semiprime/Maxima/semiprime.maxima
2023-09-16 17:28:03 -07:00

5 lines
301 B
Text

/* The first part consider the cases of squares of primes, the second part the remaining cases */
semiprimep(n):=if integerp(sqrt(n)) and primep(sqrt(n)) then true else lambda([x],length(ifactors(x))=2 and unique(map(second,ifactors(x)))=[1])(n)$
/* Example */
sublist(makelist(i,i,100),semiprimep);