Artificial intelligent assistant

Formula to Condense 65000 to 255 I'm working on a problem for a Python program, and I'm stuck on figuring out a solution to this math problem: I have a robot that records the "brightness" of the light through a sensor by a value of 0-65000, with 65000 being the darkest. I then need to turn this value into an RGB color scale (0-255) I need to use a whole number, 0-65000, and convert it down to a value of 0-255. Is this possible with a mathematical formula?

$\times \frac{255}{65000}$ converts it to a value in 0-255 range.

You can use floor or Ceil functions to make it a whole number (approximates)

How we found it:

I'm denoting value in $0-65000$ scale as $d$, and in $0-255$ scale in $r$.

$65000\equiv 255, d\equiv r\implies 255\times d=65000\times r\implies r=\frac{d\times 255}{65000}$

**Edit:** since you want to translate it to 65000 to 0, easiest way will be $255-\frac{d\times 255}{65000}$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 3e4f225cef67fea1f7e7e6d5cf934e06