If you really want to do it like you said, using spaces, and not as @lawlist suggested, find the line containing (number-to-string w)
in function linum-update-window
and change it to:
(number-to-string (+ w 1))
This number is the width of the box in which the line number is printed, right aligned.
The original w
is the number of digits in the last line number.