Quick answer, the FMC programme is written in Octal 3 digit code (Incredible to believe that it's not Hexidecimal).
511 is 8 raised to the power of 3 minus 1, i.e. 8X8X8 = 512 - 1 = 511!
Now, if they'd only used the first three 'digits' of the four available in Hexidecimal, that would allow FFF, of which &H(FFF) = 4096 - 1 = 4095, a much better distances for fixes!
The minus 1, of course, is because all counting begins at zero, not 1.
There's all sorts of number bases available, Octal, Decimal, Hexidecimal etc. In the FMC/LNAV programmes that I write, I use a base of 215, which allows for extremely large numbers to be "crunched" into a few digits of computer code
Regards,
Old Smokey