Take a positive integer \$k\$ as input. Start with \$n := 1\$ and repeatedly increase \$n\$ by the largest integer power of ten \$i\$ such that \$i \le n\$ and \$i + n \le k\$.
Repeat until \$n = k\$ and return a list of all intermediate values of \$n\$, including both the initial \$1\$ and the ...
oh yeah, i normally don't use the more complicated predicates like findall. i'm sure there's a really obvious, short solution i've missed :| (i can tell that findall will probably help if i have a predicate that matches only valid numbers, but that... doesn't seem easy)