genpoly takes three arguments : a polynomial P with n−1
variables, an integer b and the name of a variable var.
genpoly returns the polynomial Q with n variables (the P variables
and the variable var given as second argument), such that :
In other words, P is written in base b but using the convention that the euclidean remainder belongs to ]−b/2 ; b/2] (this convention is also known as s-mod representation). Input :
Output :
^
2-2*x+1Indeed 61 divided by 6 is 10, remains 1, then 10 divided by 6 is 2 remains -2 (instead of the usual quotient 1 and remainder 4 out of bounds),
61=2*6^{2}−2*6+1 |
Input :
Output :
Indeed : 5=6−1
Input :
Output :
Indeed : 7=6+1
Input :
Output :
Indeed : x*y+x+y−1=y(x+1)+(x−1)
Input :
^2
,6,x)Output :
Indeed : x*y+x*z+y−z=y*(x+1)+z*(x−1)