A polynomial is divisible by a factor
f(n)=0 for a function
f. Your job: to determine if a polynomial function
f(x) is divisible by
The input is in the form of
(x-n), (Polynomial). Remember, if n is negative,
(x-n) will be in the input form of
(x+n). For the polynomial, all exponents will be put in as
^. Coefficients will be written next to the variable
x. An example polynomial could be
2x^2 + x^1. There will be no spaces between anything. The term
x will be inputed as
x^1. So what would "normally" look like
(x - 1) will be
(x^1-1). The coefficients and powers will always be integers. The coefficient one will be implicit if it is just
x can be interpreted as
A boolean value. Truthy, or Falsey.
Thanks to @AlexA. For helping me clarify this!
Input:(x^1-1),(x^1-1) Output: True Input: (x^1+2),(2x^2+4x^1+2) Output: False Input: (x^1+7),(x^2-49) Output: True
- This is code-golf, so shortest code in bytes wins
Unfortunately, I don't know how to implement the snippet leaderboard. If anyone knows how, feel free to edit the post.