Software
Let's not do this all by hand


The above is a screenshot of my software (which seems to evolve every time I work with it... I will try to keep this section up to date) after generating the first Ulam spiral. It is written in a language that allows quick protyping, with the sacrifice of some speed. I needed the ability to quickly change things as I experimented with different methods of creating Ulam spirals. There is more prototyping to be done, but after reaching a stable state and conversion to a faster language the software will be made available.

The software currently uses the Sieve of Eratosthenes to identify primes. There are faster way to identify primes but the performance improvement will not have an impact on the actual process of generating the Ulams, only in the inital loading of the software... it takes 0.7 seconds to find all primes in the first 1 Million integers (which is enough for a 1000 x 1000 Ulam spiral) on my old Pentium so making this more efficient is not really a priority.

The controls on the left panel going from the top down are:

1. The size of the Ulam spiral being created. The software lets you resize arbitrarily but it is handy to be able to define specific sizes, especially when creating images for websites ;-)

2. The integer that is the centre of the Ulam spiral

3. Some people don't consider the number one to be prime, this option lets you decide where you stand on that one

4. Rendering the number 1 in red helps when doing image analysis... it serves as a reference point / marker

5. X Axis movement. This controls the movement of the centre of the Ulam spiral though each Iteration

6. Y Axis movement. Same as 5. but for the Y Axis

7. This option allows you to start at an arbitrary iteration of the Ulam spiral

8. When rendering overlaid Ulam spirals you might want the software to automatically stop after a certain number of Iterations

9. The iteration step control allows you to skip iteration steps, for example allow you to render every 5th Ulam Iteration

10. Take pictures... when ticked the software will save a picture of the rendering screen after each Iteration is finished rendering. The image is first saved as a .bmp and a background process converts this to an optimized .gif and removes the .bmp

11. The create animated .gif option instructs the software to join together all the .gif images that are saved to produce a single animated .gif file

12. When the clear screen option is checked the rendering area is cleared between each Ulam Iteration... good for watching the evolution of the Ulam spiral as it progresses through the integer spiral iterations

13. Go easy on the CPU means give the PC a chance to breathe... the software can run at 100% CPU and will get to the finish line faster, but my poor old PC can get a bit over heated if I run at max speed for too long so I thought I'd be a bit considerate.

14. Invert color tells the software to render the primes as white pixels on a black background

15. The zoom setting tells the software to draw filled squares rather than single pixels... effectively zooming into the spiral. 2 x 2 filled square for 2 x zoom, 4 x 4 square for 4 x zoom... etc.

16. The delay setting allows you to set a delay in millseconds between each ulam iteration being rendered

17. The show numbers options tells the software to render the actual numbers in their location on the spiral... this setting will only take effect when zooming in to a certain level as there just isn't room to render them before that, even at a ridiculously small font


Copyright © 2010 H Rudd