OFFSET
1,1
COMMENTS
REFERENCES
Joseph O'Rourke and Stan Wagon, Gaussian prime spirals, Mathematics Magazine, vol. 86, no. 1 (2013), p. 14.
LINKS
T. D. Noe, Table of n, a(n) for n = 1..2829
MATHEMATICA
loop[n_] := Module[{p = n, direction = 1}, lst = {n}; While[While[p = p + direction; ! PrimeQ[p, GaussianIntegers -> True]]; direction = direction*(-I); AppendTo[lst, p]; ! (p == n && direction == 1)]; Length[lst]]; nn = 20; ps = {}; Do[If[PrimeQ[i + (j - i) I, GaussianIntegers -> True], AppendTo[ps, i + (j-i)*I]], {j, 0, nn}, {i, 0, j}]; Table[loop[ps[[n]]]; Total[Abs[Differences[lst]]], {n, Length[ps]}]
CROSSREFS
KEYWORD
nonn
AUTHOR
T. D. Noe, Feb 27 2013
STATUS
approved