spread_integer function

Spread an integer to a given length