Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get the coordinates of the points on a triangular spiral
ResourceFunction["TriangularSpiralPoints"][n] gives the list of coordinate pairs on an equilateral triangular spiral with n sides starting at the origin. |
Here are the points on the first four legs of the spiral:
In[1]:= |
Out[1]= |
This shows the sequence of points in order for the first six sides:
In[2]:= |
Out[2]= |
40 black sides with 20 red sides overlaid:
In[3]:= |
Out[3]= |
The number of points in the first n sides are one more than the triangular numbers:
In[4]:= |
Out[4]= |
In[5]:= |
Out[5]= |
This finds the coordinate pairs that are a prime distance along the square spiral:
In[6]:= |
The larger points correspond to the primes 2, 3, 5, 7, 11:
In[7]:= |
Out[7]= |
About 12% of the numbers up to 11326 are prime:
In[8]:= |
Out[8]= |
In[9]:= |
Out[9]= |
Here is a plot of the first 1369 primes:
In[10]:= |
Out[10]= |
About 11% of the numbers up to 11326 are lucky:
In[11]:= |
Out[11]= |
This finds the coordinate pairs that are at lucky number distances along the triangular spiral:
In[12]:= |
Here are the first 1248 lucky numbers plotted along the triangular spiral:
In[13]:= |
Out[13]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License