Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Lattice points in a square in zigzag order from the bottom-left to the top-right corner
ResourceFunction["SquareZigzagPoints"][n] gets all the points in the square with opposite corners {1,1} to {n,n} in zigzag order. |
This shows how the points are ordered in the simplest case:
| In[1]:= |
| Out[1]= |
| In[2]:= | ![]() |
| Out[2]= | ![]() |
A larger example:
| In[3]:= | ![]() |
| Out[3]= | ![]() |
This starts at the bottom right:
| In[4]:= |
| Out[4]= |
This shows the path:
| In[5]:= | ![]() |
| Out[5]= | ![]() |
This starts horizontally at the bottom right:
| In[6]:= |
| Out[6]= |
This shows the path:
| In[7]:= | ![]() |
| Out[7]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License