Of course if the 1 bit is in the next to last word, the last word is all zero. An unpleasant coding task is discovering the bit position of the 1 bit within its word. The following techniques are more pleasant. W be a non-zero word, where the word length is n.
Execution is quite speedy.
The maximum value of Ord 2 is given by p Euler's phi-function, sometimes called the totient. If p is not prime, the totient is smaller.