Wolfram Language (Mathematica), 124 bytes
Thanks to Martin Ender for saving 12 bytes!
Image[#/Max@#]&[Array[(n=0;Max[4#2#2-Max[+##,3#2-#],4#
#-{+##,3#-#2}]+1//.x_?CompositeQ:>PrimePi[++n;x];n)&,{#,#},(1-#)/2]]&
-----------
Because TIO doesn't allow image output, I run xxd
on TIO to get the hexdump of the image. Unfortunately I didn't install xxd
and I don't know how to use xxd
I can't add an image. However this is theThe image generated on my machine with n = 101
is:
[![Spiral][1]][1][Spiral][2]][2] [1][2]:https https://i.sstatic.net/zbOTT07Dg5.png
Closed form formula of the spiral value taken directly from this answer of mine.