Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Problem involving sequence(CON)
Posted:
Jun 17, 1996 7:15 AM


Last time I 've post a problem as follow : Given two positives integers p and q , Generates the longest possible sequence of integer numbers which sum of any p consecutive is positive and sum of any q consecutive is negative.
I 've got the solutions but I 'm not sure if it 's right or not. Can anyone verify the following method?
First : The length of the sequence is less than p + q  gcd(p,q) for sure (Anyone who want to know how to prove this please mail me)
To simplify the problem add another variable n ( = length of the sequence) for the given numbers n,p and q ,this problem can be modeled as a system of equations. for example if (n,p,q) = (5,3,4) the following equations will solve the problem. Let the sequence be x[1],x[2],x[3],...,x[5] The equations are x[1]+x[2]+x[3] = c1 x[2]+x[3]+x[4] = c2 x[3]+x[4]+x[5] = c3 x[1]+x[2]+x[3]+x[4] = c4 x[2]+x[3]+x[4]+x[5] = c5
and c1,c2,...,c5 are positive integers I 've tried to solve this problem by programming. I 've found it works for arbitary value of c1,c2,c3,c4 and c5. And as far as I 've tested my program I 've found that the longest possible length is always = p + q  gcd(p,q)  1. But anyway I couldn't prove that arbitary positive integers can be used for ci and the longest possible length is as I 's mentioned. Can anyone verify it? Or is there a better way to solve this problem?



