Let $n_1,n_2,\ldots n_k$ be a sequence of $k$ consecutive odd integers. If $n_1+n_2+n_3=p_3$ and $n_k+n_{k−1}+n_{k−2}+n_{k−3}+n_{k−4}=q_4$ where both $p$ and $q$ are prime, what is k?
I found in previous answers the equations below, can anyone explain to me how this has been found?
the first sum can be written as $3n_1+6=p_3$ the second sum can be written as $5n_k−20=q_4$. the second sum is also $5n_1+10k−30=q_4$
Thank you
Let $B = n_1$. Then $n_j = B + 2(j-1)$ and we can compute $$p = n_1 + n_2 + n_3 = (B) + (B+2) + (B+4) = 3B+6.$$
and $$\begin{align} &\quad \, \, \, n_k + n_{k-1} + n_{k-2} + n_{k-3} + n_{k-4} \\ &= (B + 2(k-1)) + (B + 2(k-2)) + (B + 2(k-3)) + (B + 2(k-4)) + (B + 2(k-5)) \\ &= 5B + 10k - 2 - 4 - 6 - 8 - 10 \\ &= 5B + 10k - 30 \end{align}$$
Let's first use the equation $p = 3B+6$. We can factor $3B+6 = (3)(B+2)$. But we know $p$ is prime, so the only way to factor it into positive integers is $p \cdot 1$. That means we must have $p = 3$ and $B+2 = 1$ and thus $B=-1$. In other words, our sequence of consecutive odd integers must start like $-1, 1, 3, \cdots$ and the sequence of odd integers that are summing up to $p$ is $-1, 1, 3$.
Next, let's use $q = 5B + 10k - 30$. Again we can factor this: $q = (5) (B + 2k - 6)$. We know $q>0$ and $5>0$, so we must have $B+2k-6>0$ too. We know $q$ is prime, so the only way to factor it into positive integers is $q \cdot 1$. That means we must have $q = 5$ and $B+2k-6 = 1$. From above we already know $B=-1$, so we have $-1 + 2k - 6 = 1$ and thus $k = 4$. The sequence of odd numbers adding up to $q$ is $(-3, -1, 1, 3, 5)$.