There seem to be three different colour numbering systems for colors in PD:

The positive integers, which sort colors in a seemingly random order;

The negative integers, which sort colors in the RGB scheme (so that 1 to 256 is blue, 256 * (1 to 256) is green, and 256^2 * (1 to 256) is red;

The numbers that are used to save colored objects in the .pd file, which confusingly are different than the RGB colors. (color an object with a positive or negative number, save the file and open it in a text editor, and you will not find the same numbers as you used to color the object).
Does anyone know the relationship between these three systems? Actually, I'm mostly looking for the relationship between 1 and 2, ie. I am looking to find the relationship between the positive color numbers and their RGB equivalents. The third one is just a curiosity.