#restart; read `d:/Car.txt`; #AllCar # input: positive integer N # output: set of Carmichael number less or equal to N AllCar := proc(N) local i,S; S := {}; for i from 4 to N do if isprime(i) = false and i mod 2 = 1 and Car(i) = true then S := S union {i}; fi: od: return(S); end: #Car #input: an odd composite number n #output: true if n is a Carmichael number # false otherwise. Car := proc(n) local b; # Fill in the space here # Check all the base b where gcd(b,n) =1 # if b^(n-1) mod n <> 1 then return false (right away). # return true at the end. end: