On 1/22/2022 1:25 PM, kurtz le pirate wrote:
Once you've determined a number is not prime, you can skip testing.
> // -----------------------------------------------------------
> // --- macro to test if a it is a prime numbers
> // -----------------------------------------------------------
> #macro IsPrime(n)
> #local cnt = 0;
> #local i=2;
> #while(i<n)
> #if(mod(n,i)=0)
> #declare cnt=cnt+1;
#break
> #end
> #declare i=i+1;
> #end
> (cnt=0)
> #end
Post a reply to this message
|