1

I'm messing around with doing a visualization that has nothing to do with the primes and in order to execute it correctly I need an ordered list of all point in the order that the Ulam Spiral crosses them. I've tried some of my work but have only run in to abundantly complicated paths to solution. Also is there a name for looking for pattern that generally occur in spiral, whether they are related to primes or not?

E.g.: Starting with this image:

enter image description here

if $1$ is at the origin, then the list would be as follows: $$(0,0),(1,0),(1,1),(0,1),(-1,1),(-1,0),(-1,-1),(0,-1),(1,-1),‌​(2,-1),(2,0),...$$

iadvd
  • 8,961
  • 11
  • 39
  • 75
  • please can you give an example of your phrase? " I need an ordered list of all point in the order that the Ulam Spiral crosses them". In my case, I find it difficult to understand. An example would clarify what you mean. – iadvd Aug 10 '17 at 06:16
  • 1
    Starting with this image https://upload.wikimedia.org/wikipedia/commons/1/1d/Ulam_spiral_howto_all_numbers.svg, if 1 is at the origin, then the list would be as follows: (0,0),(1,0),(1,1),(0,1),(-1,1),(-1,0),(-1,-1),(0,-1),(1,-1),(2,-1),(2,0),... – Aaron Quitta Aug 10 '17 at 07:07
  • much better with the example! just in case, I did long time ago a similar question, is not exactly the same, but it might give you ideas. If I can think a solution to your request I will be back! so just in case: https://math.stackexchange.com/questions/1345430/how-can-i-calculate-the-formula-of-this-fractal-like-structure – iadvd Aug 10 '17 at 07:35

2 Answers2

3

You are lucky because it seems that a very similar pair of sequences is already at OEIS.

The $x$-coordinates are sequence A174344 ("List of $x$-coordinates of point moving in clockwise spiral") and $y$-coordinates ("List of $y$-coordinates of point moving in clockwise spiral") are sequence A268038.

List of $x$-coordinates of point moving in clockwise spiral.

$$0, 1, 1, 0, -1, -1, -1, 0, 1, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 0, -1, -2, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -2, \cdots$$

List of $y$-coordinates of point moving in clockwise spiral.

$$0, 0, -1, -1, -1, 0, 1, 1, 1, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -2, -1, 0, 1, 2, 3, 4, 4, 4, \cdots$$

In the referred OEIS pages there are formulas to calculate each sequence of coordinates.

iadvd
  • 8,961
  • 11
  • 39
  • 75
  • @AaronQuitta I think this fits your needs... basically OEIS is always a good place to start looking for this kind of sequences. The trick is looking for one of the coordinates only or a description of the sequence. It usually works. – iadvd Aug 10 '17 at 07:51
  • I guess my only problem now is that the program that I am using for implementation does not work with the type of recursive functions mentioned in the OEIS pages. – Aaron Quitta Aug 10 '17 at 15:14
  • @AaronQuitta really? they seem very easy to implement... which program are you using? If you are learning for yourself, I would suggest you to learn Python to do your Math tests. Specifically the Anaconda distribution. – iadvd Aug 10 '17 at 15:23
  • By program I do not mean programming language, what I use is Desoms, desmos.com/calculator/ . – Aaron Quitta Aug 10 '17 at 15:36
0

A piecewise, explicit function is provided by the accepted answer of a similar question.