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 a1. We have the following:
s=n(2a1+(n1)d)2
Multiply both sides by 2n:
2sn=2a1+(n1)d
Subtract both sides by (n1)d and divide by 2:
a1=2s(n2n)d2n
Since a1 is an integer, this means that:
2s(n2n)d0(mod2n)
2s(n2n)d(mod2n)

2sn(n1)d(mod2n)
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 n2.



In both cases, either d=1 or d=2 solves the equation. Thus, we substitute both d=1 and d=2 into the equation:
a1=2sn(n1)d2n

If for d=1 or d=2, we get a natural number for a1, 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:AB and I want to get bijection. Can I just resting codomain to f(A)? I know that every function i...