Also a well known bug in your code:)
but 1024 is faster
so n-bit resolution delivers 2^n voltage ranges... q.e.d.
Sorry, no q.e.d. today
In my opinion the problem is not that easy.
For single ended conversion, the result isADC = V IN ? 1024 / V REFwhere VIN is the voltage on the selected input pin and VREF the selected voltage reference (seeTable 23-3 on page 262 and Table 23-4 on page 263). 0x000 represents analog ground, and0x3FF represents the selected reference voltage minus one LSB.
Rob had it right in the first place.