Spacing for \bmod is wrong in superscripts
Since \bmod
is implemented as a \mathbin
, it gets the spacing of a binary operator, which is generally no extra space in super- and subscripts. The space needs to be added explicitly.
See the StackExchange post for details.