回复 10楼 czz5242199
嗯,确实错了,想当然了,多谢曹哥点醒还以为不会有超过 sqrt(n)的质因数
[fly]存在即是合理[/fly]
#include <stdio.h> #include <math.h> int main() { __int64 i = 3, n, temp, a; temp = n = 600851475143; while (1) { a = (__int64)sqrt((double)temp); for (;i <= a;i += 2) if (temp % i == 0) break; if (i > a) { printf("%I64d = %I64d\n", temp, n); break; } printf("%I64d * ", i); temp /= i; } return 0; }