Fix index overflow issue in examples

All three examples contained a bug where the reg_position index overflows too early due to a greater-than-or-equal comparison to reg_size_lessone. One solution is to replace the greater-than-or-equal comparison operator with a greater-than operator. The better solution is to retain the >= operator, but to remove entirely the reg_size_lessone variable. It is somewhat clumsy to store as a separate variable another variable that has been decremented by one.