# Triangle -> Tetrahedron

## Description

I made an algorithm that maps the RGB color space into a tetahedron pattern. There are 766 layers, and the colors in every layer add up to the same amount. The first layer only has black. In order, the amount of colors per layer are: 1, 3, 6, 10, 15, 21, ... Basically the triangle numbers.
Every layer starts with blue and transitions to green in one cycle, and transitions to red the more the gradient cycles (you can see it if you zoom in).
But for layers from index 256 to 765, some colors are excluded since they're out of bounds.
Because each layer's color adds up to the same amount, they're technically sorted by Average.

Not just that, but the input index is also mapped into a triangle pattern. The same as tetrahedron, but in two dimensions. That's why the color sequence goes diagonally.

Trivia: index 2,829,056 (x: 1953, y: 425), being color [256,0,0] is the first color that is off bounds, causing it to be ignored.

## Stats

Date April 6, 2024 16,777,216 16,777,216 4,096 × 4,096 15,619,514