Skip to main content
deleted 222 characters in body
Source Link
user202729
  • 17.4k
  • 2
  • 37
  • 70

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]]&

Try it online!

-----------

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 = 101is:

[![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.

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]]&

Try it online!

-----------

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 the image generated on my machine with n = 101:

[![Spiral][1]][1] [1]:https://i.sstatic.net/zbOTT.png


Closed form formula of the spiral value taken directly from this answer of mine.

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]]&

Try it online!

-----------

The image generated is:

[![Spiral][2]][2] [2]: https://i.sstatic.net/07Dg5.png


Closed form formula of the spiral value taken directly from this answer of mine.

deleted 640 characters in body
Source Link
user202729
  • 17.4k
  • 2
  • 37
  • 70

Wolfram Language (Mathematica), 136124 bytes

Thanks to Martin Ender for saving 12 bytes!

Image[#/Max@#]&[p=Max@#]&[Array[(#-1)/2;Table[Tr[1^NestWhileList[PrimePi,Max[4x
xn=0;Max[4#2#2-Max[x+yMax[+##,3x3#2-y]#],4y4#
y#-{x+y+##,3y3#-x#2}]+1,CompositeQ]]-1//.x_?CompositeQ:>PrimePi[++n;x];n)&,{y,-p#,p#},{x,(1-p,p}]]&#)/2]]&

Try it online!Try it online!


 

-----------

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 the image generated on my machine with n = 101:

[![Spiral][1]][1] [1]:https://i.sstatic.net/zbOTT.png


Closed form formula of the spiral value taken directly from this answer of mine.


And... explanation.


(* Rescale the matrix # from [0..Max@#] to [0..1] *)
      #/Max@#

(* Create an image from the data. *)
Image[       ]& [
  p=(#-1)/2;

  (* Construct a table of values of s(f(x,y)). *)
  Table[

         (* Repeatedly apply PrimePi function while the value is
            still Composite. The second argument is taken directly
            from the other answer. *)
         NestWhileList[PrimePi,Max[...]+1,CompositeQ]

    (* Count the number of values used minus one. *)
    Tr[1^                                            ]-1

    (* Let the range of x and y be -p..p. *)
    ,{y,-p,p},{x,-p,p}
  ]
]&

Wolfram Language (Mathematica), 136 bytes

Image[#/Max@#]&[p=(#-1)/2;Table[Tr[1^NestWhileList[PrimePi,Max[4x
x-Max[x+y,3x-y],4y
y-{x+y,3y-x}]+1,CompositeQ]]-1,{y,-p,p},{x,-p,p}]]&

Try it online!


 

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 the image generated on my machine with n = 101:

[![Spiral][1]][1] [1]:https://i.sstatic.net/zbOTT.png


Closed form formula of the spiral value taken directly from this answer of mine.


And... explanation.


(* Rescale the matrix # from [0..Max@#] to [0..1] *)
      #/Max@#

(* Create an image from the data. *)
Image[       ]& [
  p=(#-1)/2;

  (* Construct a table of values of s(f(x,y)). *)
  Table[

         (* Repeatedly apply PrimePi function while the value is
            still Composite. The second argument is taken directly
            from the other answer. *)
         NestWhileList[PrimePi,Max[...]+1,CompositeQ]

    (* Count the number of values used minus one. *)
    Tr[1^                                            ]-1

    (* Let the range of x and y be -p..p. *)
    ,{y,-p,p},{x,-p,p}
  ]
]&

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]]&

Try it online!

-----------

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 the image generated on my machine with n = 101:

[![Spiral][1]][1] [1]:https://i.sstatic.net/zbOTT.png


Closed form formula of the spiral value taken directly from this answer of mine.

No syntax-highlighting is better than broken syntax-highlighting
Source Link
totallyhuman
  • 17.3k
  • 3
  • 32
  • 88
Image[#/Max@#]&[p=(#-1)/2;Table[Tr[1^NestWhileList[PrimePi,Max[4x
x-Max[x+y,3x-y],4y
y-{x+y,3y-x}]+1,CompositeQ]]-1,{y,-p,p},{x,-p,p}]]&
Image[#/Max@#]&[p=(#-1)/2;Table[Tr[1^NestWhileList[PrimePi,Max[4x
x-Max[x+y,3x-y],4y
y-{x+y,3y-x}]+1,CompositeQ]]-1,{y,-p,p},{x,-p,p}]]&

(* Rescale the matrix # from [0..Max@#] to [0..1] *)
      #/Max@#

(* Create an image from the data. *)
Image[       ]& [
  p=(#-1)/2;

  (* Construct a table of values of s(f(x,y)). *)
  Table[

         (* Repeatedly apply PrimePi function while the value is
            still Composite. The second argument is taken directly
            from the other answer. *)
         NestWhileList[PrimePi,Max[...]+1,CompositeQ]

    (* Count the number of values used minus one. *)
    Tr[1^                                            ]-1

    (* Let the range of x and y be -p..p. *)
    ,{y,-p,p},{x,-p,p}
  ]
]&

(* Rescale the matrix # from [0..Max@#] to [0..1] *)
      #/Max@#

(* Create an image from the data. *)
Image[       ]& [
  p=(#-1)/2;

  (* Construct a table of values of s(f(x,y)). *)
  Table[

         (* Repeatedly apply PrimePi function while the value is
            still Composite. The second argument is taken directly
            from the other answer. *)
         NestWhileList[PrimePi,Max[...]+1,CompositeQ]

    (* Count the number of values used minus one. *)
    Tr[1^                                            ]-1

    (* Let the range of x and y be -p..p. *)
    ,{y,-p,p},{x,-p,p}
  ]
]&
Image[#/Max@#]&[p=(#-1)/2;Table[Tr[1^NestWhileList[PrimePi,Max[4x
x-Max[x+y,3x-y],4y
y-{x+y,3y-x}]+1,CompositeQ]]-1,{y,-p,p},{x,-p,p}]]&

(* Rescale the matrix # from [0..Max@#] to [0..1] *)
      #/Max@#

(* Create an image from the data. *)
Image[       ]& [
  p=(#-1)/2;

  (* Construct a table of values of s(f(x,y)). *)
  Table[

         (* Repeatedly apply PrimePi function while the value is
            still Composite. The second argument is taken directly
            from the other answer. *)
         NestWhileList[PrimePi,Max[...]+1,CompositeQ]

    (* Count the number of values used minus one. *)
    Tr[1^                                            ]-1

    (* Let the range of x and y be -p..p. *)
    ,{y,-p,p},{x,-p,p}
  ]
]&
Image[#/Max@#]&[p=(#-1)/2;Table[Tr[1^NestWhileList[PrimePi,Max[4x
x-Max[x+y,3x-y],4y
y-{x+y,3y-x}]+1,CompositeQ]]-1,{y,-p,p},{x,-p,p}]]&

(* Rescale the matrix # from [0..Max@#] to [0..1] *)
      #/Max@#

(* Create an image from the data. *)
Image[       ]& [
  p=(#-1)/2;

  (* Construct a table of values of s(f(x,y)). *)
  Table[

         (* Repeatedly apply PrimePi function while the value is
            still Composite. The second argument is taken directly
            from the other answer. *)
         NestWhileList[PrimePi,Max[...]+1,CompositeQ]

    (* Count the number of values used minus one. *)
    Tr[1^                                            ]-1

    (* Let the range of x and y be -p..p. *)
    ,{y,-p,p},{x,-p,p}
  ]
]&
Make code fit in screen.
Source Link
user202729
  • 17.4k
  • 2
  • 37
  • 70
Loading
Make code fit in screen.
Source Link
user202729
  • 17.4k
  • 2
  • 37
  • 70
Loading
added 4 characters in body
Source Link
user202729
  • 17.4k
  • 2
  • 37
  • 70
Loading
Source Link
user202729
  • 17.4k
  • 2
  • 37
  • 70
Loading