U64 gcm4( U64 max, U64 n ) { U64 c, lcm; for( c = 1; ( ~n & 1 ) && ( c < 12 ); ++c ) n >>= 1; lcm = n * 4096; return ( max / lcm ) * lcm; } #### anonyM: gcm for s=2147483648 & r=1 to 1073741824 took:33.850345514550 ### original anonyM: gcm4 for s=2147483648 & r=1 to 1073741824 took:33.590549831120 ### my tweak