ftp.nice.ch/pub/next/science/mathematics/PrimeSpiral.N.bs.tar.gz#/PrimeSpiral

IB.proj
 
Makefile
 
PrimeGenerator.h
[View PrimeGenerator.h] 
PrimeGenerator.m
[View PrimeGenerator.m] 
PrimeSpiral
 
PrimeSpiral.draw
 
PrimeSpiral.iconheader
 

PrimeSpiral.nib


 
PrimeSpiral.tiff
 
PrimeSpiral_main.m
[View PrimeSpiral_main.m] 
README
 
SpiralGenerator.h
[View SpiralGenerator.h] 
SpiralGenerator.m
[View SpiralGenerator.m] 
SpiralOps.h
[View SpiralOps.h] 
SpiralOps.psw
 
SpiralView.h
[View SpiralView.h] 
SpiralView.m
[View SpiralView.m] 

README

PrimeSpiral is a demonstration application with no utility value.  To run it, shape the main window to suit (under 2.0 the initial size requires about 12 seconds to complete on an '040 NeXT and about 30 seconds on '030 hardware) and select the 'Spiral' menu item to start the program running.

The concept of the prime spiral is simple: start at the center of a square and spiral outwards, inverting those bits whose positions on the spiral correspond to a prime number.  Since there is no formula to generate primes, they have to be determined by algorithm, you would expect the pattern to be random (about a ~10% gray shade since that is roughly the frequency of primes).  What you get instead are numerous broken diagonal lines, voids and other patterns (let your imagination and intuition figure out why).

The prime spiral also represents a benchmark as it tests how efficiently your workstation (or programmer) can compute primes and plot single bit data points on a graphic display.  We implemented this program on several different workstations.  You can start with either zero as your center (like this implementation) or one (like our CommonLisp ones), it doesn't really affect the resulting pattern.  The direction you spiral doesn't matter either.

The concept of the prime spiral was described to Christopher Schmidt (formerly of SUMEX-AIM, now an independent software developer) and myself (among others) by Alan Perlis when we were undergraduates at Yale (~1980).  Our first implementation was in Interlisp on the Xerox 1100 in 1983.  Recently (February 1990), Christopher Schmidt and Richard Acuff reimplemented the program under CommonLisp for the Macintosh (Procyon CommonLisp), and TI microExplorer and Explorer II, as well as the Xerox 1186 running Xerox CommonLisp.  This NeXT implementation is our first non-Lisp port of the program.

According to Perlis, someone once produced a tablecloth with this pattern--if anyone knows more about that, please let me know.  Any optimizations to the prime generation or graphics code would also be most welcome.

- Christopher (lane@sumex-aim.stanford.edu)

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.