A Spiral of numbers











up vote
3
down vote

favorite












I am trying to produce a spiral of numbers from 1 through 101 with the following properties:



-- multiples of 5 are in a node shaped like pentagon



-- there is a special starburst node at numbers 3, 6, 11, 13, 17, 23, 29, 37, 43, 52, 56, 61, 63, 68, 69, 71, 72, 80, 91, 99.



(I think one could use the shapes.geometric library to achieve both of these if only I could figure out how to switch styles at specific values of x in the loop below.)



Here is where I am (with help from here):



documentclass[parskip]{scrartcl}
usepackage[margin=15mm]{geometry}
usepackage{stix}
usepackage{tikz}
usetikzlibrary{shapes.geometric}
usetikzlibrary{calc}
usepackage{pifont}
usepackage{wasysym}
usepackage{graphicx}

begin{document}
hspace{0pt} vfill
begin{center}
newcounter{cntRoot}
begin{tikzpicture}
coordinate (a) at (0,0);
coordinate (b) at (0:1);
foreach x in {1,...,100}{%
coordinate (c) at ($(b)!0.9cm!270:(a)$);
setcounter{cntRoot}{x}
addtocounter{cntRoot}{1}
node[fill=white,draw,circle,inner sep=1pt] at (c)
{$thecntRoot$};
coordinate (b) at (c);
};
end{tikzpicture}
end{center}
vfill
end{document}


I tried to implement ideas from this answer without much success. Any help would be much appreciated!










share|improve this question




























    up vote
    3
    down vote

    favorite












    I am trying to produce a spiral of numbers from 1 through 101 with the following properties:



    -- multiples of 5 are in a node shaped like pentagon



    -- there is a special starburst node at numbers 3, 6, 11, 13, 17, 23, 29, 37, 43, 52, 56, 61, 63, 68, 69, 71, 72, 80, 91, 99.



    (I think one could use the shapes.geometric library to achieve both of these if only I could figure out how to switch styles at specific values of x in the loop below.)



    Here is where I am (with help from here):



    documentclass[parskip]{scrartcl}
    usepackage[margin=15mm]{geometry}
    usepackage{stix}
    usepackage{tikz}
    usetikzlibrary{shapes.geometric}
    usetikzlibrary{calc}
    usepackage{pifont}
    usepackage{wasysym}
    usepackage{graphicx}

    begin{document}
    hspace{0pt} vfill
    begin{center}
    newcounter{cntRoot}
    begin{tikzpicture}
    coordinate (a) at (0,0);
    coordinate (b) at (0:1);
    foreach x in {1,...,100}{%
    coordinate (c) at ($(b)!0.9cm!270:(a)$);
    setcounter{cntRoot}{x}
    addtocounter{cntRoot}{1}
    node[fill=white,draw,circle,inner sep=1pt] at (c)
    {$thecntRoot$};
    coordinate (b) at (c);
    };
    end{tikzpicture}
    end{center}
    vfill
    end{document}


    I tried to implement ideas from this answer without much success. Any help would be much appreciated!










    share|improve this question


























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I am trying to produce a spiral of numbers from 1 through 101 with the following properties:



      -- multiples of 5 are in a node shaped like pentagon



      -- there is a special starburst node at numbers 3, 6, 11, 13, 17, 23, 29, 37, 43, 52, 56, 61, 63, 68, 69, 71, 72, 80, 91, 99.



      (I think one could use the shapes.geometric library to achieve both of these if only I could figure out how to switch styles at specific values of x in the loop below.)



      Here is where I am (with help from here):



      documentclass[parskip]{scrartcl}
      usepackage[margin=15mm]{geometry}
      usepackage{stix}
      usepackage{tikz}
      usetikzlibrary{shapes.geometric}
      usetikzlibrary{calc}
      usepackage{pifont}
      usepackage{wasysym}
      usepackage{graphicx}

      begin{document}
      hspace{0pt} vfill
      begin{center}
      newcounter{cntRoot}
      begin{tikzpicture}
      coordinate (a) at (0,0);
      coordinate (b) at (0:1);
      foreach x in {1,...,100}{%
      coordinate (c) at ($(b)!0.9cm!270:(a)$);
      setcounter{cntRoot}{x}
      addtocounter{cntRoot}{1}
      node[fill=white,draw,circle,inner sep=1pt] at (c)
      {$thecntRoot$};
      coordinate (b) at (c);
      };
      end{tikzpicture}
      end{center}
      vfill
      end{document}


      I tried to implement ideas from this answer without much success. Any help would be much appreciated!










      share|improve this question















      I am trying to produce a spiral of numbers from 1 through 101 with the following properties:



      -- multiples of 5 are in a node shaped like pentagon



      -- there is a special starburst node at numbers 3, 6, 11, 13, 17, 23, 29, 37, 43, 52, 56, 61, 63, 68, 69, 71, 72, 80, 91, 99.



      (I think one could use the shapes.geometric library to achieve both of these if only I could figure out how to switch styles at specific values of x in the loop below.)



      Here is where I am (with help from here):



      documentclass[parskip]{scrartcl}
      usepackage[margin=15mm]{geometry}
      usepackage{stix}
      usepackage{tikz}
      usetikzlibrary{shapes.geometric}
      usetikzlibrary{calc}
      usepackage{pifont}
      usepackage{wasysym}
      usepackage{graphicx}

      begin{document}
      hspace{0pt} vfill
      begin{center}
      newcounter{cntRoot}
      begin{tikzpicture}
      coordinate (a) at (0,0);
      coordinate (b) at (0:1);
      foreach x in {1,...,100}{%
      coordinate (c) at ($(b)!0.9cm!270:(a)$);
      setcounter{cntRoot}{x}
      addtocounter{cntRoot}{1}
      node[fill=white,draw,circle,inner sep=1pt] at (c)
      {$thecntRoot$};
      coordinate (b) at (c);
      };
      end{tikzpicture}
      end{center}
      vfill
      end{document}


      I tried to implement ideas from this answer without much success. Any help would be much appreciated!







      tikz-pgf tikz-styles






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago

























      asked 2 hours ago









      kan

      3,15112154




      3,15112154






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote













          I am sure that there is a more efficient way of dealing with your starbursts (for example, using LaTeX3), but the code below deals with them by first defining a comma separated list of special numbers and them looping through all of them to see if there is a match. The numbers mod 5 are easy to deal with using pgfmathparseresult.



          The end result is then:



          enter image description here



          Here is the code:



          documentclass[parskip]{scrartcl}
          usepackage[margin=15mm]{geometry}
          usepackage{stix}
          usepackage{tikz}
          usetikzlibrary{shapes,shapes.geometric,calc}
          usepackage{pifont}
          usepackage{wasysym}
          usepackage{graphicx}
          newififnotfound% to mark the stars as we print them
          newcommandstarbursts{3,6,11,13,17,23,29,37,43,52,56,61,63,68,69,71,72,80,91,99}
          begin{document}

          begin{tikzpicture}
          coordinate (a) at (0,0);
          coordinate (b) at (0:1);
          foreach x in {1,...,100}{%
          coordinate (c) at ($(b)!0.9cm!270:(a)$);
          pgfmathparse{int(mod(x,5))}
          ifnumpgfmathresult=0
          node[fill=white,draw,regular polygon, regular polygon sides=5,inner sep=1pt] at (c) {$x$};
          else
          notfoundtrue% this will mark any starbursts
          foreach y in starbursts {% check for stars
          ifnumx=y% a star is born!
          node[fill=white,draw,starburst,inner sep=1pt] at (c) {$x$};
          globalnotfoundfalse% need global as inside a loop
          fi
          }
          ifnotfound% we have not printed a node yet
          node[fill=white,draw,circle,inner sep=1pt] at (c) {$x$};
          fi
          fi
          coordinate (b) at (c);
          };
          end{tikzpicture}

          end{document}





          share|improve this answer





















          • Thank you so much for your help! Much appreciated!
            – kan
            37 mins ago











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "85"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462906%2fa-spiral-of-numbers%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote













          I am sure that there is a more efficient way of dealing with your starbursts (for example, using LaTeX3), but the code below deals with them by first defining a comma separated list of special numbers and them looping through all of them to see if there is a match. The numbers mod 5 are easy to deal with using pgfmathparseresult.



          The end result is then:



          enter image description here



          Here is the code:



          documentclass[parskip]{scrartcl}
          usepackage[margin=15mm]{geometry}
          usepackage{stix}
          usepackage{tikz}
          usetikzlibrary{shapes,shapes.geometric,calc}
          usepackage{pifont}
          usepackage{wasysym}
          usepackage{graphicx}
          newififnotfound% to mark the stars as we print them
          newcommandstarbursts{3,6,11,13,17,23,29,37,43,52,56,61,63,68,69,71,72,80,91,99}
          begin{document}

          begin{tikzpicture}
          coordinate (a) at (0,0);
          coordinate (b) at (0:1);
          foreach x in {1,...,100}{%
          coordinate (c) at ($(b)!0.9cm!270:(a)$);
          pgfmathparse{int(mod(x,5))}
          ifnumpgfmathresult=0
          node[fill=white,draw,regular polygon, regular polygon sides=5,inner sep=1pt] at (c) {$x$};
          else
          notfoundtrue% this will mark any starbursts
          foreach y in starbursts {% check for stars
          ifnumx=y% a star is born!
          node[fill=white,draw,starburst,inner sep=1pt] at (c) {$x$};
          globalnotfoundfalse% need global as inside a loop
          fi
          }
          ifnotfound% we have not printed a node yet
          node[fill=white,draw,circle,inner sep=1pt] at (c) {$x$};
          fi
          fi
          coordinate (b) at (c);
          };
          end{tikzpicture}

          end{document}





          share|improve this answer





















          • Thank you so much for your help! Much appreciated!
            – kan
            37 mins ago















          up vote
          3
          down vote













          I am sure that there is a more efficient way of dealing with your starbursts (for example, using LaTeX3), but the code below deals with them by first defining a comma separated list of special numbers and them looping through all of them to see if there is a match. The numbers mod 5 are easy to deal with using pgfmathparseresult.



          The end result is then:



          enter image description here



          Here is the code:



          documentclass[parskip]{scrartcl}
          usepackage[margin=15mm]{geometry}
          usepackage{stix}
          usepackage{tikz}
          usetikzlibrary{shapes,shapes.geometric,calc}
          usepackage{pifont}
          usepackage{wasysym}
          usepackage{graphicx}
          newififnotfound% to mark the stars as we print them
          newcommandstarbursts{3,6,11,13,17,23,29,37,43,52,56,61,63,68,69,71,72,80,91,99}
          begin{document}

          begin{tikzpicture}
          coordinate (a) at (0,0);
          coordinate (b) at (0:1);
          foreach x in {1,...,100}{%
          coordinate (c) at ($(b)!0.9cm!270:(a)$);
          pgfmathparse{int(mod(x,5))}
          ifnumpgfmathresult=0
          node[fill=white,draw,regular polygon, regular polygon sides=5,inner sep=1pt] at (c) {$x$};
          else
          notfoundtrue% this will mark any starbursts
          foreach y in starbursts {% check for stars
          ifnumx=y% a star is born!
          node[fill=white,draw,starburst,inner sep=1pt] at (c) {$x$};
          globalnotfoundfalse% need global as inside a loop
          fi
          }
          ifnotfound% we have not printed a node yet
          node[fill=white,draw,circle,inner sep=1pt] at (c) {$x$};
          fi
          fi
          coordinate (b) at (c);
          };
          end{tikzpicture}

          end{document}





          share|improve this answer





















          • Thank you so much for your help! Much appreciated!
            – kan
            37 mins ago













          up vote
          3
          down vote










          up vote
          3
          down vote









          I am sure that there is a more efficient way of dealing with your starbursts (for example, using LaTeX3), but the code below deals with them by first defining a comma separated list of special numbers and them looping through all of them to see if there is a match. The numbers mod 5 are easy to deal with using pgfmathparseresult.



          The end result is then:



          enter image description here



          Here is the code:



          documentclass[parskip]{scrartcl}
          usepackage[margin=15mm]{geometry}
          usepackage{stix}
          usepackage{tikz}
          usetikzlibrary{shapes,shapes.geometric,calc}
          usepackage{pifont}
          usepackage{wasysym}
          usepackage{graphicx}
          newififnotfound% to mark the stars as we print them
          newcommandstarbursts{3,6,11,13,17,23,29,37,43,52,56,61,63,68,69,71,72,80,91,99}
          begin{document}

          begin{tikzpicture}
          coordinate (a) at (0,0);
          coordinate (b) at (0:1);
          foreach x in {1,...,100}{%
          coordinate (c) at ($(b)!0.9cm!270:(a)$);
          pgfmathparse{int(mod(x,5))}
          ifnumpgfmathresult=0
          node[fill=white,draw,regular polygon, regular polygon sides=5,inner sep=1pt] at (c) {$x$};
          else
          notfoundtrue% this will mark any starbursts
          foreach y in starbursts {% check for stars
          ifnumx=y% a star is born!
          node[fill=white,draw,starburst,inner sep=1pt] at (c) {$x$};
          globalnotfoundfalse% need global as inside a loop
          fi
          }
          ifnotfound% we have not printed a node yet
          node[fill=white,draw,circle,inner sep=1pt] at (c) {$x$};
          fi
          fi
          coordinate (b) at (c);
          };
          end{tikzpicture}

          end{document}





          share|improve this answer












          I am sure that there is a more efficient way of dealing with your starbursts (for example, using LaTeX3), but the code below deals with them by first defining a comma separated list of special numbers and them looping through all of them to see if there is a match. The numbers mod 5 are easy to deal with using pgfmathparseresult.



          The end result is then:



          enter image description here



          Here is the code:



          documentclass[parskip]{scrartcl}
          usepackage[margin=15mm]{geometry}
          usepackage{stix}
          usepackage{tikz}
          usetikzlibrary{shapes,shapes.geometric,calc}
          usepackage{pifont}
          usepackage{wasysym}
          usepackage{graphicx}
          newififnotfound% to mark the stars as we print them
          newcommandstarbursts{3,6,11,13,17,23,29,37,43,52,56,61,63,68,69,71,72,80,91,99}
          begin{document}

          begin{tikzpicture}
          coordinate (a) at (0,0);
          coordinate (b) at (0:1);
          foreach x in {1,...,100}{%
          coordinate (c) at ($(b)!0.9cm!270:(a)$);
          pgfmathparse{int(mod(x,5))}
          ifnumpgfmathresult=0
          node[fill=white,draw,regular polygon, regular polygon sides=5,inner sep=1pt] at (c) {$x$};
          else
          notfoundtrue% this will mark any starbursts
          foreach y in starbursts {% check for stars
          ifnumx=y% a star is born!
          node[fill=white,draw,starburst,inner sep=1pt] at (c) {$x$};
          globalnotfoundfalse% need global as inside a loop
          fi
          }
          ifnotfound% we have not printed a node yet
          node[fill=white,draw,circle,inner sep=1pt] at (c) {$x$};
          fi
          fi
          coordinate (b) at (c);
          };
          end{tikzpicture}

          end{document}






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 48 mins ago









          Andrew

          29.7k34279




          29.7k34279












          • Thank you so much for your help! Much appreciated!
            – kan
            37 mins ago


















          • Thank you so much for your help! Much appreciated!
            – kan
            37 mins ago
















          Thank you so much for your help! Much appreciated!
          – kan
          37 mins ago




          Thank you so much for your help! Much appreciated!
          – kan
          37 mins ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462906%2fa-spiral-of-numbers%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          Refactoring coordinates for Minecraft Pi buildings written in Python