2
$\begingroup$

We define $f(n) = a^n + b^n + c^n $ for some positive integers $(a,b,c)$ such that $a

Let $M$ be an integer constant, and $p \leq q$ two integers. Given the values of $f(2),f(3)$ and $f(4)$, find $$\displaystyle{\sum_{k = p}^q f(k)} \, \, \text{mod} \, M$$ If there are multiple possibilities for $(a,b,c)$ we choose the lexicographically smallest one.

Note : Since this is algorithmic, it must be done as fast as possible and we assume there is a solution.

What I've tried so far (A brute-force approach) : going through all the possible values of $a$ since we can deduce an upper bound for its value until we find the corresponding couple $(b,c)$. Then computing $\sum a^k$, $\sum b^k$ and $\sum c^k$ as geometric sums. This is a too slow approach of course.

Any better approach ?

  • 2
    Related to same OP's [Diophantine system of equations](http://math.stackexchange.com/questions/2077969/diophantine-system-of-equations). Note that the former is from an ongoing contest.2017-01-01

1 Answers 1

1

First, express $f(2), f(3), f(4)$ in terms of elementary symmetric functionss of $a, b, c$ (Newton's formula), and then use the values to solve for said functions $s_1, s_2, s_3.$ Once you do, you see that $a, b, c$ are roots of the equation

$x^3=s_1 x^2 - s_2 x + s_3,$ and so

$f(k) = s_1 f(k-1)- s_2 f(k-2) + s_1 f(k-3),$ at which point you are done.

  • 0
    Are you talking about these relations ? ($p_i = f(i)$) ${\begin{aligned}p_{1}&=s_{1},\\p_{2}&=s_{1}p_{1}-2s_{2},\\p_{3}&=s_{1}p_{2}-s_{2}p_{1}+3s_{3},\\p_{4}&=s_{1}p_{3}-s_{2}p_{2}+s_{3}p_{1}-4s_{4},\\&{}\end{aligned}}$. If this is the case then I think they involve 4 elementary functions and the value of $f(1)$ that we don't have. Where am I mistaken ? (If you could clarify your answer a bit more)2017-01-01
  • 1
    @Guru Not exactly. $p_2,$ $p_3$ and $p_4$ can be expressed in terms of $s_1, s_2, s_3.$ Three equations, three unknowns. No need for $p_1.$ Even better, two of the $s_i$ are easily eliminated. For example, $s_2 = (p_2 - s_1^2)/2.$2017-01-01
  • 0
    I get it, thank you !2017-01-01
  • 0
    Rethinking it .. Can we easily get the values of $s_1,s_2$ and $s_3$ ? It seems like the system of the three unknowns is complicated .. I mean there are powers, products etc ..2017-01-01
  • 0
    When you eliminate two of the variables, you get a cubic equation in the third, for which you can use the cubic formula. Are you trying to design an algorithm or get a closed form? There is none, if the latter.2017-01-01
  • 0
    I need an algorithm of course but the expressions of $s_i$ we are going to get are really long, I dit it in WolframAlpha and the answer is incredible. Besides, where do we use here the fact that we choose the least triplet $(a,b,c)$. This way, it just looks like the triplet is unique while it's not actually ..2017-01-01
  • 0
    Igor, this is from some sort of (current) programming contest,2017-01-02