The idea is to use the fact that if you rotate each cycle in this representation once, then each number sits above its image in the permutation. IntegerSpiral represents an elegant way to use the Gaussian integers to generate a spiral on the integer lattice in the plane. It is an improved version of the program given in Paul Abbott's article above. True if n is not divisible by the square of a prime, and False otherwise. The entries are assumed to be floating-point numbers.
Subsets generates the subsets of a set.
Gives the number of representations of a positive integer as a sum of two squares where order and sign matters.