Those numbers aren't randomly selected, they're the runlevels of your system. The runlevel used to determine which init scripts are run. They're mostly obsolete now. And if you're on Linux, it's highly likely that the runlevels S and 1 are the same. Your documents might be really old, or they'd probably be using `update-rc.d` instead of manually creating symlinks.
So your loop is iterating over all runlevels, 1-6 and S.