Alnitak's algorithm also needs to be corrected.:
Algorithm: Alnitak's algorithm
Time required to calculate in nanoseconds: 47100
ResultAlgorithm: 6857wei2912's algorithm
Time required to calculate in nanoseconds: 10775546488
 From thepace's algorithm onwards, the algorithmsbenchmarks run too fast to be used as benchmarkseffective. Using a 1000 trials:
Algorithm: wei2912's algorithm
Average time per trial (ns): 14537
Algorithm: Alnitak's algorithm
Average time per trial (ns): 10309
 Looks like Alnitak's algorithm is faster.
 Generating a million random ints and feeding them into my algorithmin:
Algorithm: wei2912's algorithm
Average time per trial (ns): 1528712073
Algorithm: Alnitak's algorithm
Average time per trial (ns): 8602
 Alnitak's algorithm appears to be 2 times faster. Great job to Alnitak! :)
 I'd be glad to accept any suggestions for benchmarks.