Updated per suggestions by jaytea. Now took 140 ticks to determine $isprime(31095121) to be $true. Before it got pretty laggy. Also, I always inc first on while loops so I won't forget, so starting at 3 would make it provide a false result for $isprime(9) as %x would equal 5 when it started the check =P.
And yes, I do understand that there are limitations here. And when you get up to very large numbers (some of the largest mIRC will be able to handle), it may become a bottleneck. But hey, if we can't have $isprime and $iscomposite built-in, this is better than nothing for those who may need it! =P