## Monday, May 05, 2014

### Simple arithmetic

I rarely go for a walk without my camera. Once, someone stopped me to ask if I was a photographer. "No," I said, "I just like to take pictures." It's a little like that with numbers. I like to play with them but that doesn't make me a mathematician.

Some time ago, Peter Luschny asked me to help him with the English in a mathematical treatise he is writing. I agreed. More recently he wanted me to calculate additional terms of a sequence therein and (after he explained the program he had written for it) I managed to do that. There had been an obvious and not unexpected size-bias in that sequence's terms at even indices versus the terms at odd indices. In particular, Peter noted that the terms at positions 2, 6, 10, 14, etc. were zero. In what was for me an unusual stance, I decided to see if I could prove it.

Consider a list of n -1s and n +1s: {-1, -1, -1, ..., +1, +1, +1}, 2n terms. What Peter's program does is accumulate those terms, then accumulate again the terms just derived, and — for all possible permutations of our list — count how often the final number in that second accumulation is zero. I better explain what I mean by accumulate. In Mathematica, Accumulate[{a, b, c, d}] yields {a, a+b, a+b+c, a+b+c+d}. We don't actually need to know what the exact permutation of our 2n terms is, only that they are all odd:

{odd, odd, odd, odd, odd, odd, odd, odd, ..., odd, odd}.

The first accumulation yields:

{odd, even, odd, even, odd, even, odd, even, ..., odd, even} (2n terms)

because of course an odd plus an odd is an even and an even plus an odd is an odd. The second accumulation (knowing that an even plus an even is another even) yields:

{odd, odd, even, even, odd, odd, even, even, ..., even, even} for 2n divisible by 4, or
{odd, odd, even, even, odd, odd, even, even, ..., odd, odd} for 2n not divisible by 4.

The important thing here is that in the latter case the final term is odd, thus never zero. Since we are counting zeros, the total number for 2n = {2, 6, 10, 14, ...} will always be zero. The count in the other case, 2n = {0, 4, 8, 12, ...}, appears to be