Mersenne primes are used in Computer Science and Cryptography because they support fast modulo computation. If $p$ is a Mersenne prime, $n \bmod p$ can be computed with just a few add and shift operations.
Is there a well known, similarly fast, way to compute $\lfloor n/p \rfloor$? That is a way that uses only basic operations, such as shifts, adds and perhaps multiplications, but no divisions?
It doesn't appear to follow directly from the modulus computation. I have searched for all the terms I could think of, but nothing has appeared so far.
I think something like Algorithm 6 in https://ece.uwaterloo.ca/~ahasan/web_papers/technical_reports/web_lwpfi.pdf is what I was looking for:
Setting
c = 1gives a division free way to divide by Mersenne primes, and for generalcit does Pseudo-Mersenne numbers.Edit: I found a more efficient algorithm for this and other operations using Mersenne primes: https://arxiv.org/abs/2008.08654
Edit 2: Bug corrections for Python implementation - Firstrock