# About a Variant of Ulam Spiral

I asked this on Math.SE but got no answer:

Here I read about a variant on the Ulam spiral:

[A] structure may be seen when composite numbers are also included in the Ulam spiral. [...] Using the size of the dot representing an integer to indicate the number of factors and coloring prime numbers red and composite numbers blue produces the figure shown.

The figure below is the resulting spiral:

Questions:

1. Is it surprising that there are thick diagonals? (Stated in the same manner as is stated about the original one,) is it surprising that there are quadratics which generate surprisingly large number of composites with many divisors? Isn't there a simple explanation?

2. How exactly do the variant and the original spirals relte? Thinking only about the dots and not their colors, the primes and the composites with very few divisors are not distinguishable in the variant.

-
Would you mind adding links to the M.SE post and there back here? People might want to be able to follow the discussions. – András Bátkai Apr 27 '14 at 16:17
The m.se post was math.stackexchange.com/questions/767940/… --- I have also added a link here from there. – Gerry Myerson Apr 28 '14 at 0:04
I'm working as a hobby in a similar problem. I've been able to decompose the spiral into fractions using more dots per integer and also highlight the mobius function values using RGB colors and a dot notation for primes and special numbers. There is a nice display of patterns there and controls to change the spiral, but I'm still working in describing them out. Maybe you could see things that I can't: alganet.github.io/Ulam-spiral – alganet May 7 '14 at 0:17

Notice that the numbers $n^2$ and $n^2+n$ are very close to the diagonals, and it is natural that they have much more divisors than average numbers of the same size. Similarly, whenever we have a quadratic of the form $(n+a)(n+b)$, it should not be a surprise that it produces numbers with a lot of divisors.
One simple reason for some irreducible quadratics to have more primes than others is the following: if we for instance have the quadratic $n^2+900$, then it can only be prime when $n$ is coprime to $30$ , which restricts the values of $n$ quite much, so there should not be even nearly as many such primes as there are of the form $n^2+1$, say.
If you are interested in less trivial cases, then the conjecture of Hardy and Littlewood conserning primes represented by quadratics, that is, $\{n\leq x: an^2+bn+c \quad \text{prime}\}\sim\frac{A}{\sqrt{a}}\frac{\sqrt{x}}{\log x}$, where $A$ is a certain product, would explain why some quadratics generate a lot more primes than others.
To explain the conjecture, I suppose you could look at quadratic fields (see also the original paper by Hardy and Littlewood). For example, in the case of the polynomial $n^2+1$ you could consider the Gaussian integers, and then the question would just be: How often $n+i$ and $n-i$ are simultaneously prime in $\mathbb{Z}[i]$? Taking into account certain divisibility obstructions and the prime number theorem in $\mathbb{Z}[i]$, you should arrive at the asymptotic.