J, 11 chars
=

       f=.#~@i.@>:
       f 5
    1 2 2 3 3 3 4 4 4 4 5 5 5 5 5