Lucas-Lehmer test: Difference between revisions

m
→‎Quick Remainder: remove incorrect clause in description
m (→‎Quick Remainder: repaired indent)
m (→‎Quick Remainder: remove incorrect clause in description)
Line 834:
 
=== Quick Remainder ===
The mod function, (<code>%</code>) has a computation cost equivalent to the divide operation. In this case, (since the quotient is an odd number with all ones when in binary format), a combination of ands, shifts and adds can replace the mod function. Another change is creating the list of candidate Mersenne numbers in descending order, the point being to start the more time consuming calculations first. This avoids a long calculation occurring by itself at the end of the <code>Parallel.For</code> queue.
 
<lang csharp>using System;