N will not usually be an integer, even if T_on and T_off are integers. Remember that 0.001 is not exactly representable in binary floating point, so division by 0.001 is not the same thing as multiplication by 1000, and we as outside observers have no reason to expect that T_on and T_off are integer valued.
With N not usually being an exact integer even if 1000*(T_on+T_off) would be an integer, it becomes difficult to predict the length of
Due to round-off in floating point calculations, this could end up one item shorter than it looks like it "should" be.
You should probably define N as an integer using round() and then use