PHP, 39 bytes
<?while($a=rand(0,$a??$argn))echo$a?>
\n
\n
To run it:
echo '<input>' | php -nF <filename>
This uses PHP's null coalescing operator (??
) to set $a
's initial value to $argn
.
The two \n
s are supposed to represent blank lines because I couldn't get them to show up any other way. They add one blank line after the output, since 0
isn't printed.
Example output:
141265555
\n