How to solve this system of equation in sage?
How to solve this system of equations in sage?
$x_1+l_1x_2+l_1^2x_3+\dots+l_1^kx_k=c_1+r $x_1+l_1x_2+l_1^2x_3+\dots+l_1^{k-1}x_k=c_1+r $.
$x_1+l_2x_2+l_2^2x_3+\dots+l_2^kx_k=c_2+r^2$$x_1+l_2x_2+l_2^2x_3+\dots+l_2^{k-1}x_k=c_2+r^2$
$\dots $
$x_1+l_kx_2+l_k^2x_3+\dots+l_k^kx_k=c_k+r^k$$x_1+l_kx_2+l_k^2x_3+\dots+l_k^{k-1}x_k=c_k+r^k$
where $l_i$'s are different positive integers and $c_i,r$ are integers in $[0,256]$
In particular, we can solve with sage. Here is the code :
a0, a1,a2,b3,b4, b5,r,l1,l2,l3 = var('a0,a1,a2,b3,b4,b5, r,l1,l2,l3')
X=solve([a0+l1*a1+l1^2*a2==b3+r^3, a0+l2*a1+l2^2*a2==b4+r^2,a0+l3*a1+l3^2*a2==b5+r^1], a0,a1, a2)