Tuesday, December 15, 2015

sequences and series - Validity of Arithmetic Progression



Given the sum of arithmetic progression and number of terms . We have to determine whether the arithmetic progression exists or not . First term and common difference should be natural numbers .



e.g - if n = 10 and S = 265 ; then answer should be "true" as the AP would be - 4 , 9 , 14 , 19 , 24 , 29 , 34 , 39 , 44 , 49 .



if n = 4 and S = 24 ; then answer should be "true" as the AP would be - 3 , 5 , 7 , 9 .



Answer



Let the sum be $s$, the number of terms be $n$, the common difference be $d$ and the first term be $a_1$. We have the following:
$$s=\frac{n(2a_1+(n-1)d)}{2}$$
Multiply both sides by $\frac 2 n$:
$$\frac{2s}{n}=2a_1+(n-1)d$$
Subtract both sides by $(n-1)d$ and divide by $2$:
$$a_1=\frac{2s-(n^2-n)d}{2n}$$
Since $a_1$ is an integer, this means that:
$$2s-(n^2-n)d \equiv 0 \pmod {2n}$$
$$2s \equiv (n^2-n)d \pmod {2n}$$

$$2s \equiv n(n-1)d \pmod {2n}$$
Now, since the right side is a multiple of $n$ and $n$ is a factor of $2n$, this means that the left side is also a multiple of $n$.




  • If $n$ is odd and $2s$ is a multiple of $n$, then the $2$ isn't helping since it's not a factor of $n$, so $s$ has to be a multiple of $n$.

  • If $n$ is even and $2s$ is a multiple of $n$, then the $2$ is helping since it is a factor of $n$, so $s$ only has to be a multiple of $\frac n 2$.



In both cases, either $d=1$ or $d=2$ solves the equation. Thus, we substitute both $d=1$ and $d=2$ into the equation:
$$a_1=\frac{2s-n(n-1)d}{2n}$$

If for $d=1$ or $d=2$, we get a natural number for $a_1$, then we have found the arithmetic sequence necessary to create sum $s$ and number of terms $n$. Otherwise, no such sequencer exists.


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...