Ulam spiral 2
Like Ulam, I had a boring moment and began drawing a spiral like him's. But his version is utterly incorrect, as the \ diagonal distorts the equation n^2
.
The following picture illustrates an wrong Ulam spiral at left and a correct at right:
I challenge you to output a numbered Ulam spiral, the right version, where it is mandatory to highlight the primes. The input is n
, meaning the point where the spiral ends. For the image example I gave n
was 100
. It will always begin at 1
I don't care what highlight style you use (different color, font weight, circle around number, etc), given it makes the primes easily distinguishable form the rest.
There will be no accepted answer; just did it for fun.
graphical-output math sequence primes number arithmetic integer