LET a=2
INPUT k
LET n=k-1
LET x=1
LET p=a
DO WHILE n>0
   IF MOD(n,2)=1 THEN LET x=MOD(x*p,k)
   LET n=INT(n/2)
   LET p=MOD(p*p,k)
LOOP
IF x<>1 AND k>a THEN PRINT k;"is a composite number." ELSE PRINT k;"may be prime."
END

