# How to represent a sequence of odd numbers given specific criterea

I'm trying to figure out how to represent a sequence of ODD numbers given the following conditions:

1) I know how many numbers are in the sequence (N). 2) I know the average of all the numbers in the sequence. 3) I know the sum of all the numbers in the sequence.

Example: Given the sequence 21, 23, 25, 27, and 29 (N == 5), the average of the sequence is 25, and the sum of the numbers in the sequence is 125... How do I express that sequence mathematically? I need it to work for values of N that are much greater than 5.

N+1 would yield a sequence of 31, 33, 35, 37, 39, 41 with the average being 36 or (N*N).

-
Your conditions don't yield a unique sequence. Do you want it to be increasing as well? –  Samuel May 23 '13 at 5:54
There is a substantial body of related results. There are various interpretations of your question. Here are some questions that will help any answerer. (i) Does order matter? Is $1,3,5$ different from $3,5,1$? (ii) Are we allowed things like $3,3,3$? –  André Nicolas May 23 '13 at 5:56
increasing numbers, in order, without skipping, so 1,3,5,7,9, etc. –  jacecar May 23 '13 at 6:24
Note you don't need to know the sum (your part 3) since it can be calculated from the average and $N$. Also note your initial values for the average and $N$ must be either both even, or both odd, in order that you wind up getting a sequence of odd numbers. –  coffeemath May 23 '13 at 8:12

## 1 Answer

For a sequence of $N$ consecutive odd numbers, $$a, a + 2, a + 4, \dots, a + 2(N - 1),$$ the average is \begin{align} \frac{1}{N} &\left[ a + (a + 2) + (a + 4) + \cdots + (a + 2(N - 1)) \right] \\ &= \frac{1}{N} \left[ (a + a + a + \cdots + a) + (0 + 2 + 4 + \cdots + 2(N - 1) \right] \\ &= \frac{aN + N(N - 1)}{N} \\ &= a + N - 1. \end{align} So, if you know $N$ and the average $m$, from the equation $m = a + N - 1$, you can find the first number in your sequence: $$a = m - N + 1.$$ Now, count by twos.

-
Your answer works whether $a$ is even or odd, so that it gives equally well a sequence of even numbers or a sequence of odd numbers. To guarantee odd numbers $m=N \mod 2$ is required, as is clear from the formula you give for $a$. Oh, and +1 –  coffeemath May 23 '13 at 8:09