There already have been multiple challenges about carryless multiplication, this challenge will work with the same calculation rules.
You task is given a quadratic polynomial ax²+bx+c
, to find an integer r
such that a*r*r+b*r+c
is zero, with +
meaning exclusive or and *
being carryless multiplication (use xor to add up the numbers in binary long multiplication).
Input: Polynomial ax²+bx+c
for instance given as an coefficient vector
Goal: find a number r
such that a*r*r+b*r+c=0
with *
being multiplication without carry and +
being exclusive or.
Rules:
- You may assume there is an integral solution
- You only need to return a single solution of the equation
- The returned solution may be different if the program is called multiple times
- This is code-golf the shortest solution (per language) wins
Examples:
x²+x -> x=0 or x=1
x²+3x+2 -> x=1 or x=2
x²+5 -> x=3
x²+7x+12 -> x=3 or x=4
5x²+116x+209 -> x=25
x²+12x+45 -> x=5 or x=9
a>1
:5x²+116x+209 -> x=25
\$\endgroup\$(x+2)(x+2)
andx²
) I doubt it is an equivalence. Note that the "numbers" in this problem are just a shorthand notation for polynomials in F2[y] (2
meansy
not1+1
) \$\endgroup\$