# Function Repository Resource:

# TriangularSpiralPoints

Get the coordinates of the points on a triangular spiral

Contributed by: George Beck
 ResourceFunction["TriangularSpiralPoints"][n] gives the list of coordinate pairs on an equilateral triangular spiral with n sides starting at the origin.

## Details and Options

The list starts at the origin and goes (roughly) NW, SW, E and repeats.

## Examples

### Basic Examples

Here are the points on the first four legs of the spiral:

 In:= Out= This shows the sequence of points in order for the first six sides:

 In:= Out= 40 black sides with 20 red sides overlaid:

 In:= Out= The number of points in the first n sides are 1 more than the triangular numbers:

 In:= Out= In:= Out= ### Neat Examples

This finds the coordinate pairs that are a prime distance along the square spiral:

 In:= The larger points correspond to the primes 2, 3, 5, 7, 11:

 In:= Out= About 12% of the numbers up to 11326 are prime:

 In:= Out= In:= Out= Here is a plot of the first 1369 primes:

 In:= Out= About 11% of the numbers up to 11326 are lucky:

 In:= Out= This finds the coordinate pairs that are at lucky number distances along the triangular spiral:

 In:= Here are the first 1248 lucky numbers plotted along the triangular spiral:

 In:= Out= ## Requirements

Wolfram Language 11.3 (March 2018) or above
{"ft_lang_label":"__label__en","ft_lang_prob":0.6465004,"math_prob":0.9917954,"size":1425,"snap":"2019-35-2019-39","text_gpt3_token_len":408,"char_repetition_ratio":0.17452498,"word_repetition_ratio":0.05907173,"special_character_ratio":0.3354386,"punctuation_ratio":0.11510792,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9972484,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"im_url_duplicate_count":[null,null,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-09-23T19:36:53Z\",\"WARC-Record-ID\":\"<urn:uuid:ae15e338-c7d4-4287-8e18-17b760b8d1ed>\",\"Content-Length\":\"44681\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2e2a8af8-c26b-4205-9c81-56ccce8343d8>\",\"WARC-Concurrent-To\":\"<urn:uuid:280f0576-fd52-4dec-b841-1f8686d55110>\",\"WARC-IP-Address\":\"140.177.16.83\",\"WARC-Target-URI\":\"https://resources.wolframcloud.com/FunctionRepository/resources/TriangularSpiralPoints\",\"WARC-Payload-Digest\":\"sha1:UTFR6MK2AKI4FJDMA53P5QINKREWRGQN\",\"WARC-Block-Digest\":\"sha1:YZF4MMP72ETTM3QOAIWEVNSBBUHQTSWM\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-39/CC-MAIN-2019-39_segments_1568514578201.99_warc_CC-MAIN-20190923193125-20190923215125-00344.warc.gz\"}"}