s+n+@?[s-]n-s[-n@;]s+r[s-]s[s-n@+r+]s+r-[s-]r+s[o++++++++++n@-[s-]s[-r+]]s+r--[s-]r++s[n@+o-[s-]s[-r--n+@-n-]]
Try It Online! This was a massive pain to write. Takes about ten seconds for n=3.
This would be a fairly easy challenge even for a Turing tarpit like In Floop... if there was a print instruction. In Floop only outputs the value of the current variable on termination. So, we have to calculate the output value as a single integer by repeatedly adding 1 and multiplying by 10.
In Floop has four integer variables; n, o, r, and s; in addition to an arbitrarily large array of integers @ which can be indexed into by the variables. Unfortunately, the state machine I came up with for this has five, which I'll call input (@[1]), state (r), inv (s), acc (@[0]) and copy (o).
One other thing I should note is that In Floop can only check if a variable is nonzero, so I'll use the idiom s+r+[s-]s[-...] to check if a variable's zero a lot - Set s to 1, if condition's nonzero set it to 0, if s is nonzero set it to 0 and continue.
s+n+@?[s-]n-s[-n@;] # Termination check / setup
n+@? n- # Try writing input value into input
s+ [s-] s[- ] # If it's zero
n@; # Print acc and terminate
s+r[s-]s[s-n@+r+] # Set up multiplication
s+ [s-]s[s- ] # If
r # State is 0 (start)
n@+ # Increment acc
r+ # State = 1 (multiplying)
s+r-[s-]r+s[o++++++++++n@-[s-]s[-r+]] # Multiply acc by 10
s+ [s-]. s[ ] # If
r- r+ # State is 1 (multiplying)
o++++++++++ # Add 10 to copy
n@- # Decrement acc
[s-]s[- ] # If acc == 0
r+ # State = 2 (copying)
s+r--[s-]r++s[n@+o-[s-]s[-r--n+@-n-]] # Finish loop
s+ [s-] s[ ] # If
r-- r++ # State == 2 (copying)
n@+ # Increment acc
o- # Decrement copy
[s-]s[- ] # If copy is zero
r-- # State = 0 (setup)
n+@-n- # Decrement input
xis 0? And does it explicitly have to be a program using input and output, or would just a function returning a string count? \$\endgroup\$xis 0, it prints0because printing1zero times is the same as doing nothing. For the second question, I'm not the original author of the challenge so let's say that it counts. \$\endgroup\$1,1,1,1,1,0as the output. What about1 1 1 1 1 0? Or[1,1,1,1,1,0]? \$\endgroup\$