> On Aug 30, 2017, at 10:43 PM, Don Kelly <[email protected]> wrote:
> 
> I agree with your opinion of what Skip wrote.  looking back to Gauss and 
> figuring out the symmetry works for both odd and even cases (42 &43 for 
> example. However in his statement the numbers are 1...21 where the numbers 
> are 2 to 42  all even numbers- the result is still 21*22 . 42%2 is 21 which 
> is odd so that there is 1 number that isn't paired and 20  pairs averaging 22 
> and the oddball is 1 number =22  Hence 22*21. The same result is for 1 to 43 
> as the odd numbers are ignored. If one considers evens between 2 and 44, 
> there are 22 pairs (no oddball) averaging 23- the same rule works average 
> =1+number of pairs. For summing odd numbers, add 1 to each number, drop the 
> odds and do the even sum- then subtract the total (21 in this case to get 
> 462-21=441.

I don't understand why you worry about pairing, but if j code makes it easier 
to understand, here is a derivation I learned from my elementary school.

NB. for any evenly spaced sequence X: a, a+b, a+2*b, ... , a+(n-1)*b
X =. a+n*i.b
( +/ -: +/@|.               ) X
( +/ -: -:@(+/ + +/@|.)     ) X
( +/ -: -:@([:+/ +/@(,:|.)) ) X
( +/ -: -:@([:+/ ##{.+{:)   ) X
( +/ -: -:@(#*{.+{:)        ) X

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to