# can sequences with Nth term formulas be combined?

#### laurencewithau

##### New member
Hi, I used to be a maths teacher but that was years ago and I'm rusty. My question concerns sequences and series. If two simple integer sequences, each with its own nth term formula, are combined, in what conditions can the resulting sequence have its own nth term formula? Here's my example: 1, 4, 3, 8, 5, 12, .... This combines odd numbers and double numbers, the formulas being 2n - 1 and 2n. I've tried and failed to find an nth term formula that works for each term rather than one for the even terms and another for the odd. Any help would be much appreciated.

#### Dr.Peterson

##### Elite Member
My first thought is this: Yes, it can be done; but there is no advantage in it, because it makes a much more complicated formula that hides what is happening.

You should be aware of "piecewise-defined functions", which are defined by stating the value of the function in two or more cases. That is a perfectly valid way to state a formula, and it makes the nature of the function or sequence clear.

But one common way to do what you are asking for is to make use of sequences like 1, 0, 1, 0, ..., which can be expressed as "n mod 2" if the mod function is available (as in Excel), or constructed from other functions, like (1 - (-1)^n)/2. Try that out, and see if you can find a formula for your example.

#### pka

##### Elite Member
Hi, I used to be a maths teacher but that was years ago and I'm rusty. My question concerns sequences and series. If two simple integer sequences, each with its own nth term formula, are combined, in what conditions can the resulting sequence have its own nth term formula? Here's my example: 1, 4, 3, 8, 5, 12, .... This combines odd numbers and double numbers, the formulas being 2n - 1 and 2n. I've tried and failed to find an nth term formula.
Try this $$\displaystyle a(n)=2n\left( {\left\lfloor {\frac{n}{2}} \right\rfloor - \left\lfloor {\frac{{n - 1}}{2}} \right\rfloor } \right) + n\left( {\left\lfloor {\frac{{n + 1}}{2}} \right\rfloor - \left\lfloor {\frac{n}{2}} \right\rfloor } \right)$$
SEE HERE

#### laurencewithau

##### New member
My first thought is this: Yes, it can be done; but there is no advantage in it, because it makes a much more complicated formula that hides what is happening.

You should be aware of "piecewise-defined functions", which are defined by stating the value of the function in two or more cases. That is a perfectly valid way to state a formula, and it makes the nature of the function or sequence clear.

But one common way to do what you are asking for is to make use of sequences like 1, 0, 1, 0, ..., which can be expressed as "n mod 2" if the mod function is available (as in Excel), or constructed from other functions, like (1 - (-1)^n)/2. Try that out, and see if you can find a formula for your example.
Hi Dr Peterson
Thanks for your reply. That's way over my head, my maths being A level at best; but it does answer my question, for what I had in mind was whether there was, if you like, an A level formula, involving just the basic operations over integers, fractions, integer powers or roots, as with geometric, arithmetic or power series, but not involving different cases with separate functions or anything like that.
So the answer, in other words, is no, it's not possible. Thanks again.

#### Dr.Peterson

##### Elite Member
If you analyze pka's answer, you'll notice that the two expressions in parentheses are my sequences 1, 0, 1, 0, ... and 0, 1, 0, 1, ..., but implemented using the floor function rather than powers of -1 or remainders as I had suggested. (Which is nicer is a matter of taste.) Apart from that detail, it is exactly what I had in mind: 2n*(1 if even) + n*(1 if odd). Notice also that the original sequences use different values of n than in the combined sequence; the originals are 2n-1 and 4n in terms of their own internal indices; after replacing n with (n+1)/2 for the former and n/2 for the latter, to put them in their proper places in the combined sequences, they become n and 2n, respectively.

There are many ways to do this; all of them will look ugly, especially if you try to "simplify" (e.g. combining like terms), which hides what is happening.

In piecewise form, the combined sequence is

$$\displaystyle a_n = \left\{\begin{matrix}n & \text{for odd }n\\ 2n & \text{for even }n\end{matrix}\right.$$​

To my mind, that is the simplest and clearest way to write it.

#### laurencewithau

##### New member
Try this $$\displaystyle a(n)=2n\left( {\left\lfloor {\frac{n}{2}} \right\rfloor - \left\lfloor {\frac{{n - 1}}{2}} \right\rfloor } \right) + n\left( {\left\lfloor {\frac{{n + 1}}{2}} \right\rfloor - \left\lfloor {\frac{n}{2}} \right\rfloor } \right)$$
SEE HERE
Hi pka,
Thanks for your reply. As I said to Dr Peterson, it's too advanced for me, but it does answer my question, which was really about whether there is a single formula in 'n' that picks up on each term of the sequence, and clearly there's not. Thanks again.

#### laurencewithau

##### New member
If you analyze pka's answer, you'll notice that the two expressions in parentheses are my sequences 1, 0, 1, 0, ... and 0, 1, 0, 1, ..., but implemented using the floor function rather than powers of -1 or remainders as I had suggested. (Which is nicer is a matter of taste.) Apart from that detail, it is exactly what I had in mind: 2n*(1 if even) + n*(1 if odd). Notice also that the original sequences use different values of n than in the combined sequence; the originals are 2n-1 and 4n in terms of their own internal indices; after replacing n with (n+1)/2 for the former and n/2 for the latter, to put them in their proper places in the combined sequences, they become n and 2n, respectively.

There are many ways to do this; all of them will look ugly, especially if you try to "simplify" (e.g. combining like terms), which hides what is happening.

In piecewise form, the combined sequence is

$$\displaystyle a_n = \left\{\begin{matrix}n & \text{for odd }n\\ 2n & \text{for even }n\end{matrix}\right.$$​

To my mind, that is the simplest and clearest way to write it.
Hi Dr Peterson. Now I have a better idea of what you mean by a valid formula not needing to be exactly the same operation on each integer value, and yes, it's really neat, and I like the way that you've just used 'n' and '2n', the '2n-1' dropping out altogether. One does wonder, though, whether two simple sequences can ever be combined in that way to yield a sequence with its own simple nth term formula. But also, similar but different, what if you have a simple sequence, say a simple linear sequence governed by a simple rule, say 'add 2', in other words an arithmetical progression, except that after a given number of terms, the rule changes, and then again, and so on. Simplest example: 1, 2, 3, 5, 7, 10, 13, 17, 21, ... The rule is 'add 1 twice, add 2 twice, add 3 twice, and so on. Again, I do not know whether a simple nth term single function formula is possible, but I would guess not. Thanks again.

#### JeffM

##### Elite Member
Perhaps I do not understand the problem.

$$\displaystyle f(n) = \sum_{k=1}^n u(k) \text { and}$$

$$\displaystyle g(n) = \sum_{k=1}^n v(k) \implies$$

$$\displaystyle h(n) = f(n) + g(n) = \sum_{k=1}^n \{u(k) + v(k)\}.$$

Is that what you were asking?

#### pka

##### Elite Member
Perhaps I do not understand the problem. Is that what you were asking?
Jeff, laurencewithau ask if it were possible to find a definite formula for the general term of the sequence:
$$\displaystyle 1,~4,~3,~16,~5,~36,\cdots$$ that is $$\displaystyle a_n=\begin{cases}n &: n\text{ is odd} \\ n^{2} &: n\text{ is even}\end{cases}$$
But that is not a single term definition. THIS IS.

#### Dr.Peterson

##### Elite Member
Hi Dr Peterson. Now I have a better idea of what you mean by a valid formula not needing to be exactly the same operation on each integer value, and yes, it's really neat, and I like the way that you've just used 'n' and '2n', the '2n-1' dropping out altogether. One does wonder, though, whether two simple sequences can ever be combined in that way to yield a sequence with its own simple nth term formula. But also, similar but different, what if you have a simple sequence, say a simple linear sequence governed by a simple rule, say 'add 2', in other words an arithmetical progression, except that after a given number of terms, the rule changes, and then again, and so on. Simplest example: 1, 2, 3, 5, 7, 10, 13, 17, 21, ... The rule is 'add 1 twice, add 2 twice, add 3 twice, and so on. Again, I do not know whether a simple nth term single function formula is possible, but I would guess not. Thanks again.
It's hard to define "simple rule"; and even harder to prove that something vaguely defined can't be done. Certainly some sequences are similar enough that they combine to make a simple formula (consider 1, 3, 5, ... and 2, 4, 6, ..., for a trivial example!). But interesting sequences probably would at the least require the ideas we've suggested (mod, floor, powers of -1, periodic functions like sine, etc.). For cases where the rule increments every k terms, I think the floor function would be very helpful, and without it I wouldn't expect much. Some special cases might be possible to do with only elementary arithmetic operations; I'm just not interested in trying.

Similarly, though, many problems are most naturally and usefully expressed not in terms of a formula at all, but an algorithm, like a computer program. (A piecewise definition is in effect a very simple conditional program.) Restricting a problem to single formulas is unnecessary (though I admit it can be fun to find one).

#### JeffM

##### Elite Member
Jeff, laurencewithau ask if it were possible to find a definite formula for the general term of the sequence:
$$\displaystyle 1,~4,~3,~16,~5,~36,\cdots$$ that is $$\displaystyle a_n=\begin{cases}n &: n\text{ is odd} \\ n^{2} &: n\text{ is even}\end{cases}$$
But that is not a single term definition. THIS IS.
Wow, I am glad that you were able to parse that question. I did not pay enough attention to the word "example." Or I would have seen that the example did not fit what purported to be the definition of the problem. And then the OP did not understand that you gave him the exact kind of answer that he wanted.

#### Denis

##### Senior Member
Or I would have seen that the example did not fit what purported....
purported
[per-pawr-tid, -pohr-]

reputed or claimed; alleged:
We saw no evidence of his purported wealth.

#### laurencewithau

##### New member
Perhaps I do not understand the problem.

$$\displaystyle f(n) = \sum_{k=1}^n u(k) \text { and}$$

$$\displaystyle g(n) = \sum_{k=1}^n v(k) \implies$$

$$\displaystyle h(n) = f(n) + g(n) = \sum_{k=1}^n \{u(k) + v(k)\}.$$

Is that what you were asking?
Hi jeffM. No, but I wish I knew how to phrase it clearly and correctly. My question is about two linear sequences in 'n', such that when they are combined into one sequence, its nth term formula is a simple formula in 'n', by which I mean a formula of the type found in A level sequences and series, so that it is a single expression in 'n' that yields all the terms of the sequence when 'n' is replaced by the successive integer values. That expression need not be linear; it could be quadratic, cubic, whatever, but nothing that requires advanced maths or number theory, so no modulus this or that, no floor function, whatever that might be. For instance, the formula for the nth term of a Fibonacci sequence is complicated but any A level maths student will understand it, because it involves no new mathematical concepts and is basically similar to a geometrical sequence or series, which he will be familiar with. Thanks again.

#### laurencewithau

##### New member
It's hard to define "simple rule"; and even harder to prove that something vaguely defined can't be done. Certainly some sequences are similar enough that they combine to make a simple formula (consider 1, 3, 5, ... and 2, 4, 6, ..., for a trivial example!). But interesting sequences probably would at the least require the ideas we've suggested (mod, floor, powers of -1, periodic functions like sine, etc.). For cases where the rule increments every k terms, I think the floor function would be very helpful, and without it I wouldn't expect much. Some special cases might be possible to do with only elementary arithmetic operations; I'm just not interested in trying.

Similarly, though, many problems are most naturally and usefully expressed not in terms of a formula at all, but an algorithm, like a computer program. (A piecewise definition is in effect a very simple conditional program.) Restricting a problem to single formulas is unnecessary (though I admit it can be fun to find one).
Hi Dr Peterson. I like your example, and what it shows is that sometimes what I said can't be done can very easily be done, and in such a way as to suggest a method: instead of taking two sequences, take one and look for ways to split it. Thanks again.

#### laurencewithau

##### New member
purported
[per-pawr-tid, -pohr-]

reputed or claimed; alleged:
We saw no evidence of his purported wealth.
Hi Denis. Are you sure? Don't forget that 'purport' is a verb, with 'purported' as past tense. Cheers.

#### stapel

##### Super Moderator
Staff member
purported
[per-pawr-tid, -pohr-]

reputed or claimed; alleged:
We saw no evidence of his purported wealth.
Hi Denis. Are you sure? Don't forget that 'purport' is a verb, with 'purported' as past tense.
Or, as demonstrated in the dictionary snippet provided, "purported" can be an "adjective", being the modifier of a "noun" and expressing a quality of that noun -- in this case, the fact that the noun, usually being a claim or a statement, has been alleged but does not seem to have been proven or is viewed with some suspicion.

#### topsquark

##### Full Member
Okay enough with the English! I've tried very hard to forget those classes and y'all are turning my stomach!

-Dan

#### laurencewithau

##### New member
Or, as demonstrated in the dictionary snippet provided, "purported" can be an "adjective", being the modifier of a "noun" and expressing a quality of that noun -- in this case, the fact that the noun, usually being a claim or a statement, has been alleged but does not seem to have been proven or is viewed with some suspicion.
Oops! I'm holding my breath, hoping that no-one will query your use of 'snippet'.