J
at the end of the program to output a list? The challenge was edited to remove the joined by spaces restriction, and you might be able to golf a byte off
user165474
user165474
user165474