Prime decomposition: Difference between revisions
Content added Content deleted
(→{{header|C}}: prime decomposition of a number N (64-bit) in C language) |
(→Version 2: correction about the square root algorithm.) |
||
Line 1,413: | Line 1,413: | ||
ulong square_root(const ulong N) { |
ulong square_root(const ulong N) { |
||
ulong res = 0, rem = N, c, d; |
ulong res = 0, rem = N, c, d; |
||
for (c = 1 << |
for (c = 1 << 62; c; c >>= 2) { |
||
d = res + c; |
d = res + c; |
||
res >>= 1; |
res >>= 1; |