# happy number plots

Max happy iteration count:

Max unhappy iteration count: (given that 4 is an immediate fail with iterCount = 0)

## coloring notes

The left plot computes happiness for both x and y.

- If x is happy, it's colored red (increasing red = higher iteration count.)
- If y is happy, it's colored blue (increasing blue = higher iteration count.)
- If neither are happy, red and green are mixed (the red channel coming from x's iteration count, green channel coming from y's iteration count)

The middle plot concatenates the string representation of both coordinates then converts that string back to a number, and the right plot multiplies x * y.
Both then use the following to assign colors:

var colors = [
/*0*/ rgbaColor (0, 130, 0, 255),
/*1*/ rgbaColor (0, 192, 0, 255),
/*2*/ rgbaColor (0, 255, 0, 255),
/*3*/ rgbaColor (43, 170, 0, 255),
/*4*/ rgbaColor (86, 85, 0, 255),
/*5*/ rgbaColor (130, 0, 0, 255),
/*6*/ rgbaColor (192, 0, 0, 255),
/*7*/ rgbaColor (255, 0, 0, 255),
];
if (happy)
color = colors[iterCount % 8];
else
color = rgbaColor (0, 0, 255 - (iterCount * 16) % 256, 255);

The order of the digits is irrelevant in the middle plot, and x * y = y * x, so they're both symmetric at least about y = x.