Working with large numbers in PHP

前端 未结 8 953
一个人的身影
一个人的身影 2020-11-22 11:22

To use modular exponentiation as you would require when using the Fermat Primality Test with large numbers (100,000+), it calls for some very large calculations.

Whe

8条回答
  •  -上瘾入骨i
    2020-11-22 12:13

    have you taken a look at bcmod()? php has issues with integers over 2^31 - 1 on 32 bit platforms.

    var_dump(bcmod("$x", '104659') ); // string(4) "2968"
    

提交回复
热议问题