Skip to main content
1 of 3
ngn
  • 15.3k
  • 2
  • 43
  • 87

APL (Dyalog Unicode), 26 bytes

⊃,/,¨∘.,\⎕⍴⊂⍞

Try it online!

never miss an opportunity to use a scan :)

prompts for a string of "digits" and then for n

due to APL's default formatting, the first few characters in the output appear close together but they are separate elements of the result array

ngn
  • 15.3k
  • 2
  • 43
  • 87