#!/bin/bash

f(){
# In a function for testing, but the following line may be a standalone script:
seq $1|sed 's/./&\n/g'|sort|tr -d \\n|sed 's/\(0*\)1/1\1/'
}

for t in 1 2 3 7 9 10 15 34 42 45 55 100 999; do
    f $t
    echo
done
