Skip to main content
3 of 5
added 57 characters in body
steenbergh
  • 8.1k
  • 1
  • 25
  • 41

##QBIC, 25 bytes

:[a|[b,1,-1|A=A+_t!c$|}?A

Sample run:

Command line: 10
12132143215432165432176543218765432198765432110987654321

Explanation:

:           Get 'a' from the command line
[a|         FOR b=1; b<=a; b++
[b,1,-1|      FOR c=b; c>=1; c--
A=A+_t!c$|      Append c to the 'output buffer' A$
}           Close the FOR loops
?A          Print 'a'

Non-competing: five minutes ago, I taught QBIC to do implicit printing on exit of anything stored in Z$. That brings the code for this challenge down to 22 bytes 19 bytes since I've made the cast-to-string autotrim!

:[a|[b,1,-1|Z=Z+!c$
steenbergh
  • 8.1k
  • 1
  • 25
  • 41