Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 64 bit algorithm that uses modular multiplicative inverse and coprime numbers, and I need to convert it to 32 bit. This math is not my area, and I cannot find an online calculator, so I hope someone here can help me.

In 64 bit, I have:

multiplier_C = 6364136223846793005;
multiplier_inv_C = -4568919932995229531;
offset_C = 1442695040888963407;

These are from Knuth's linear congruential generator. I need the following:

multiplier_C must be 30 bits in size, and multiplier_inv_C must be its modular multiplicative inverse.

offset_C must be 29 or 30 bits in size, and a coprime of $2^{32}$.

share|cite|improve this question
Take a look at Rick Regan's blog: – Rod Carvalho Sep 12 '12 at 1:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.