Skip to main content
1 of 6

Bash + GNU utilities, 96 bytes

u=$[(2**$1+1)/2]
for((;++n<u*4;)){ dc -e "5[p]sp$n^dO$1^<p";}|head -$u|sed -r "s/.*(.).{$1}/\1/"

0-based indexing.

Try it online!