Fork me on GitHub
Math for the people, by the people.

User login

Ulam spiral

\documentclass{article}
% this is the default PlanetMath preamble.  as your knowledge
% of TeX increases, you will probably want to edit this, but
% it should be fine as is for beginners.

% almost certainly you want these
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}

% used for TeXing text within eps files
%\usepackage{psfrag}
% need this for including graphics (\includegraphics)
%\usepackage{graphicx}
% for neatly defining theorems and propositions
%\usepackage{amsthm}
% making logically defined graphics
%%%\usepackage{xypic}

% there are many more packages, add them here as you need them

% define commands here

\begin{document}
The {\em Ulam spiral} (or {\em Ulam cloth}) consists of integers, starting from a given $n$ at the center, written in a spiral with the prime numbers highlighted or emphasized in some way. For example, writing a spiral with 42 at the center,

\begin{tabular}{|c|l|l|l|l|l|l|}
90 & 67 & 68 & 69 & 70 & 71 & 72 \\
89 & 66 & 51 & 52 & 53 & 54 & 73 \\
88 & 65 & 50 & 43 & 44 & 55 & 74 \\
87 & 64 & 49 & 42 & 45 & 56 & 75 \\
86 & 63 & 48 & 47 & 46 & 57 & 76 \\
85 & 62 & 61 & 60 & 59 & 58 & 77 \\
84 & 83 & 82 & 81 & 80 & 79 & 78 \\  
\end{tabular}

and then simply blanking the composites, we obtain

\begin{tabular}{|c|l|l|l|l|l|l|}
 & 67 &  &  &  & 71 &  \\
89 &  &  &  & 53 &  & 73 \\
 &  &  & 43 &  &  &  \\
 &  & &  & & &  \\
 & & & 47 & &  &  \\
 & & 61 & & 59 & &  \\
 & 83 & & & & 79 & \\  
\end{tabular}

Carrying on this process in more layers will show that most of the primes tend to fall on certain diagonals and not others.

This formation was first pondered by Stanis\l{}aw Ulam with 1 at the center. He tried carrying out the process much further, and also tried different center values, but in each case the primes would cluster on certain diagonals and sparsely populate others. Because almost all primes are odd, it is easy to explain why they would tend to form diagonals, but much more difficult to explain why they fall on certain diagonals.

\begin{thebibliography}{1}
\bibitem{mg} Gardner, M. ``Mathematical Recreations: The Remarkable Lore of the Prime Number'' {\it Scientific American} {\bf 210} 3: 120 - 128
\end{thebibliography} 
%%%%%
%%%%%
nd{document}