Befunge, 101 bytes
&20p>:000pv
>\1+^vp011<
| >.@>:55+%:00g+00p10g*v>10g-*
::\$_^#!:/+55p01*!`"~":<^\-g00
< |!-g02
+1< v\
Try it online! But note that it's going to get really slow once you get into the high forties. If you want to test the full range, you really need to be using a Befunge compiler.