The mathematical statement $x = y \pmod m$ is equivalent to the Pythonic statement (x-y)%m == 0.
Specifically, we have b == a % (3**100 + 1).
Also, what we wanted to ask is whether you can find an integer root of $g(x)$ provided that one exists.
For the sake of computing complexity in (b), you may assume that the longest run of spaces in text is of length at most 100.
That is, I don't want you to answer something like “worst case is text = ' '*n”.
Your code for (a) still needs to work for any number of spaces.
Note: it's OK if your solution for (a) has worst-case linear complexity and average-case sub-linear complexity.
How to get, if possible, worst-case sub-linear complexity is to be discussed in (c).
- We'll publish soon in Moodle the test inputs we used for Q4-Q6, so you can see how your code fared.
- Due to a misunderstanding, many of you got -4 for Q1 ("proper divisors"). To offset for it, you all get +4. No need to appeal.
- If you have an appeal about some other question, please put the exercise in my box along with a short note explaining what's the problem and I'll take care of that.