lundi 16 mai 2016

Maths, RNS residue number system, 2^n + 3 modulo way to compute. c++, bitset

I am looking for the way of computing modulo 2^n +3 from bigger number. The problem is that i don't know how to fast compute it and there is nothing on web.

I got some help for modulo of 2^n -3 and it works by that way:

Separate bits by the max length of modulo then for each of gained parts do. Multiply them by 3^m where m = number of part (for example part_1 * 3^0,part_2 * 3^1 , part_3 * 3^2). You can use the quick metod for getting the multiplied bits by using this. When you have 3^2 = 9 = 8+1 = 2^3 +1. Now you can just add the moved by 3 to the left bits of used part and adding to it not moved same part. That way i could get the results for each part then add them and do it again on acquired number till i have number lower than my modulo.

So there is any pattern like that for modulo 2^n+3 ??

Aucun commentaire:

Enregistrer un commentaire