About some finite sequences of integers

95 Views Asked by At

The following sequence of p = 7 terms: 5 ; -3 ; 1 ; -4 ; 6 ; -4 ; 1 has a positive sum, and each sum of q = 4 consecutive terms is negative. Does anybody know the general conditions on p and q to obtain that kind of property?

1

There are 1 best solutions below

1
On

This can be done if and only if $q$ doesn't divide $p$.

If $q$ doesn't divide $p$, $p=qn+r$, with $r >0$. Then the sequence

$q-1, -1, -1, -1, .., -1$ wher e there are $r$ terms, followed by a series of $n$ sequences of the form

$-1, -1, ..., q-1$, with $q$ terms works.

The exact sequence is $a_1, a_2,... a_n$ where

$a_1=q-1, a_{r+qk}=q-1 \forall 1 \leq k \leq n-1$ and $a_l=-1$ otherwide.

If $q$ divides $p$, it is trivial to show that such sequence cannot exist.

if you need the sum to be strictly negative, the problem becomes more complicated...