The hyperspace fuel equation is:
fuel = k \times ( \frac{dm}{o} )^p
Where:
 fuel is the amount of fuel consumed in tons

k is based on the rating of the FSD:
 A: 0.012
 B: 0.010
 C: 0.008
 D: 0.010
 E: 0.011
 d is the distance in light years
 m is the mass of the ship in tons
 o is the optimized mass rating of the FSD

p is based on the class of the FSD:
 2: 2.00
 3: 2.15
 4: 2.30
 5: 2.45
 6: 2.60
 7: 2.75
 8: 2.90
Solving for d:
\begin{align}
k \times ( \frac{dm}{o} )^p & = fuel \\
(\frac{dm}{o})^p & = \frac{fuel}{k} \\
\frac{dm}{o} & = \sqrt[p]{\frac{fuel}{k}} \\
dm & = \sqrt[p]{\frac{fuel}{k}} \times o \\
d & = \frac{\sqrt[p]{\frac{fuel}{k}} \times o}{m}
\end{align}
If we set fuel to be equal to the maximum fuel per jump of the FSD, then we can determine the “distance factor” for the FSD since k, p, and o are all known based on the FSD. For example, given a 5A FSD with a maximum fuel per jump of 5 tons and an optimized mass of 1,175.4 tons, the distance factor would be:
\begin{align}
\sqrt[2.45]{\frac{5}{0.012}} \times 1175.4 & = \\
\sqrt[2.45]{416.\overline{6}} \times 1175.4 & = \\
11.730 \times 1175.4 & \approx \\
& \approx 13787.442
\end{align}
Divide that value by the current mass in tons of the ship and you’ll get the max distance that the ship can jump in light years.