fix NA in Issue #5

I tracked it down with a `print` statement.  The code was doing the correct number of iterations, but it was starting the record-keeping at 0 instead of at 1. 

I was too lazy to figure out why there was only an off-by-one error *sometimes*, so I tried something simpler.  The new code just increments `rec` every time it's needed instead of calculating what it should be.