Forgive me if this has been answered, I have look all around and can’t
seem
to find an answer. I am trying to implement the Fermat primality test ( Fermat primality test - Wikipedia ) in Ruby. The
problem is
everytime ruby does the a^(n-1) computation, it seems to stumble on
numbers
like 1000 (so its doing a^999). I have set both a and n to fixnums, and
according to everything I have read, it should switch to bignum if the
result is too big. But it doesn’t seem to do that, it just seems to spit
out
infinity. Any ideas? I used the latest one click installer to install
Ruby.