本文共 479 字,大约阅读时间需要 1 分钟。
(1) Carmichael Numbers (110702)
/* Calculate b^e mod n */
int powmod(long long base, long long exp, long long m) {
long long result = 1; while ( exp > 0 ) { if ( (exp & 1) == 1 ) { result = (result * base) % m; } exp >>= 1; base = (base * base) % m; } return result; }(2) Ones(110504)
n /* Input */
temp = 1;
while (temp % n)
{
/* 1 -> 11 -> 111 -> 1111... */
/* (temp * 10 + 1) mod n = * ((temp mod n) * (10 mod n) + (1 mod n)) mod n */ temp = (temp % n) * (10 % n) + 1; x++; }转载地址:http://flrvb.baihongyu.com/