https://github.com/ros-planning/navigation2/blob/67bae86462e0242a48283c55f713ddb35861c98f/nav2_smac_planner/lattice_primitives/lattice_generator.py#L122
A simplification to this formula can be done theoretically and it would allow others to clearly understand the code, the current formula is as follows

where n = number of headings
it can be simplified to just

Note the equations match even when flooring (int) is applied.