RosettaCodeData/Task/Semiprime/Maxima/semiprime.maxima

6 lines
301 B
Text
Raw Permalink Normal View History

2023-09-16 17:28:03 -07:00
/* 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);