> with(linalg):with(numtheory): Warning, the protected names norm and trace have been redefined and unprotected Warning, the protected name order has been redefined and unprotected > carmichael:=proc(n::integer)::Boolean; > local i,l::integer, F::list; > if isprime(n) then return(false); fi: > F:=ifactors(n)[2]: > l:=linalg[rowdim](F): > for i from 1 to l do > if (F[i][2]>1) or igcd(F[i][1]-1,n-1)<>F[i][1]-1 then > return(false); > fi > od; > return(true); > end proc: > carmichael2:=proc(N::integer)::integer; > local k::integer; > k:=N; > while carmichael(k)=false do > k:=k-1; > od; > return(k); > end proc: > carmichael2(2^(16)); 63973