Prime Spirals

by Simon Whitechapel

If 1 and 2 are counted as primes, any positive integer, n, can be represented as a sum of distinct primes, p1, p2, p3... To find the sum, subtract from n the prime, p1, nearest in size to n, then repeat for n1 = n0-p1; n2 = n1-p2; etc until nk = 0. When k, the number of primes in the sum, is 1, n is itself prime:

np k 
1= 1* 1
2= 2 1
3= 3 1
4= 3 + 1* 2
5= 5 1
6= 5 + 1 2
7= 7 1
8= 7 + 1 2
9= 7 + 2 2
27= 23 + 3 + 1* 3
1354= 1327 + 23 + 3 + 1* 4

When k = 1, n itself is prime; an asterized n sets a record for k (the n for k = 5 is very large). Here are Ulam spirals for k = 1..4.

k = 1


k = 2


k = 3


k = 4

© 2008 Simon Whitechapel

The Mosaic of Primes

Maths Index

Main Index