MHB Find the nth term of the sequence.

  • Thread starter Thread starter anemone
  • Start date Start date
  • Tags Tags
    Sequence Term
AI Thread Summary
The sequence of positive integers is constructed by alternating between even and odd numbers, with the number of terms in each segment increasing linearly. The nth term can be expressed using the formula a_n = 2n - ⌊(⌊√(8n - 7)⌋ + 1)/2⌋. To determine the correct segment or "island" for a given n, one must find the largest integer k such that n is within the bounds of that island. The last element of each island corresponds to a perfect square, and the difference between terms within the island is consistently 2. This structured approach allows for an efficient calculation of any term in the sequence.
anemone
Gold Member
MHB
POTW Director
Messages
3,851
Reaction score
115
A sequence of positive integers is defined as follows:

The first term is 1.
Then take the next two even numbers 2, 4.
Then take the next three odd numbers 5, 7, 9.
Then take the next four even numbers 10, 12, 14, 16 and so on.

Find the nth term of the sequence.
 
Mathematics news on Phys.org
let N be the largest number less than 'n' in the form $\frac{k(k+1)}{2}$
$$n=k^2+2(n-N)-1$$

But here we have to find N i have an approach ,
$$n>\frac{k^2+k}{2}$$
$$2n>k^2+k$$
so i thought of finding a perfect square which less than $$2n$$ by at-least difference k or more than $$2n$$ by difference less than k
And if $$n=N$$ then $$n=k^2$$
edit:changed n to 2n in last para and added some details
 
Last edited:
the last number of m'th row is $m^2$

the first number of m'th row is $(m-1)^2+1$

for 1+2+3+4+------------+(m-1)=$\dfrac {m^2-m}{2}$

$\therefore a_(\dfrac{m^2-m+2}{2})=(m-1)^2+1$

if $a_n $ locates at m'th row

let $\dfrac {m^2-m+2}{2} \leq n------(1)$

$(m-1)^2+1=m^2-2m+2\leq 2\times n-m$

$\therefore a_n=2\times n-max(m)$

here n $\in N$

and m must satisfy (1)

for example we want to find $a_{10}$

at first we must find max(m)

$\dfrac {m^2-m+2}{2} \leq 10$

$\therefore max(m)=4$

and we have $a_{10}=20-4=16$

from (1) $\dfrac {m^2-m+2}{2} \leq n$

$m^2-m+2-2n\leq 0$

$max(m)=int(\dfrac{1+\sqrt{8n-7}}{2})$

$a_n=2n-int(\dfrac{1+\sqrt{8n-7}}{2})$
 
Last edited:
Let this sequence be denoted $\left ( a_n \right )_{n = 1}^\infty$. It's easy to see that this sequence is predictably partitioned into "islands" of odd and even elements. These islands grow in size at a linear rate. Let each island be indexed by an integer $k$, such that, for instance, the island $\{ 1 \}$ is mapped to $k = 1$, the island $\{ 2, 4 \}$ is mapped to $k = 2$, and so on.

Given an integer $n$, we first have to find in which island $k$ the element $a_n$ is located. Due to the rate at which the islands grow, it is easy to see that the $k$th island starts at position:

$$n_k = 1 + \sum_{i = 1}^{k - 1} i = 1 + \frac{1}{2} (k - 1) k$$

That is, $a_{n_k}$ is the first element of the the $k$th island. And so $a_{n_k + k - 1}$ is the last element of the $k$th island, trivially.



Suppose that $a_n$ is located in the $k$th island. Now, there must exist an $a_m$ such that $a_m$ is in the $k$th island, but $a_{m - 1}$ is not. In other words, it is the first element of the island. Then it follows that $m = n_k$. That is:

$$m = 1 + \frac{1}{2} (k - 1) k ~ ~ \implies ~ ~ k = \frac{1}{2} \left ( \sqrt{8m - 7} + 1 \right )$$

Clearly $k$ is an integer, so $8m - 7$ must be an odd perfect square. Since $m \leq n$, we deduce that $8m - 7$ is simply the largest odd perfect square less than (or equal to) $8n - 7$. Thus, we get:

$$8m - 7 = \mathcal{Q}^2 = \text{Largest odd perfect square less than or equal to } ~ 8n - 7$$

And this gives us the island we are looking for:

$$k = \frac{1}{2} \left ( \sqrt{\mathcal{Q}^2} + 1 \right ) = \frac{\mathcal{Q} + 1}{2}$$

It turns out that $\mathcal{Q}$ can be expressed more naturally using the floor function, which yields:

$$k = \left \lfloor \frac{\lfloor \sqrt{8n - 7} \rfloor + 1}{2} \right \rfloor$$

Observe that this floor function manipulation ignores the parity of $\lfloor \sqrt{8n - 7} \rfloor$ and assumes it is odd (which is what we want).



Now that we have this island, we need to figure out the value of $a_n$. To do this, we work out the value of the last element of the island. We are smart, and we notice that this element must necessarily be a perfect square, due to the fact that the $n$th perfect square is the sum of the first $n$ odd numbers (look at the difference between terms within individual islands). In fact, the last element of the $k$th island is equal to $k^2$.

Using the result obtained a while ago, $a_{n_k + k - 1} = k^2$. Finally, within any island, the difference between each consecutive term is constant and equal to $2$. We already know the index of the term $a_n$ we are looking for, since it's, well, $n$. And we know that the last element of the island is at index $n_k + k - 1$.

Doing some simplifications:

$$n_k = 1 + \frac{1}{2} (k - 1) k ~ ~ \implies ~ ~ n_k + k - 1 = \frac{1}{2} (k - 1) k + k = \frac{k^2}{2} + \frac{k}{2}$$

Almost there! Now the difference between $n_k + k - 1$ and $n$ is thus:

$$\Delta = \frac{k^2}{2} + \frac{k}{2} - n$$

Notice that $\Delta$ is always nonnegative, since $a_n$ cannot be simultaneously inside the $k$th island and greater than the last element of the $k$th island. Using the fact that the difference between consecutive terms is $2$, we finally conclude that:

$$a_n = k^2 - 2 \Delta = k^2 - 2 \left ( \frac{k^2}{2} + \frac{k}{2} - n \right ) = 2n - k$$

Putting this all in terms of $n$ using the floor function trick above, this is equivalent to:

$$a_n = 2n - \left \lfloor \frac{\lfloor \sqrt{8n - 7} \rfloor + 1}{2} \right \rfloor$$

This can probably be simplified further, but I think it looks nice as it is :p



Enumerating the first few terms of this sequence, we obtain:

$$\left ( a_n \right )_{n = 1}^\infty = \{ 1, 2, 4, 5, 7, 9, 10, 12, 14, 16, 17, 19, 21, 23, 25, 26, 28, 30, 32, 34, 36, \cdots \}$$

$$\blacksquare$$

(Whew)

 
Last edited:
Seemingly by some mathematical coincidence, a hexagon of sides 2,2,7,7, 11, and 11 can be inscribed in a circle of radius 7. The other day I saw a math problem on line, which they said came from a Polish Olympiad, where you compute the length x of the 3rd side which is the same as the radius, so that the sides of length 2,x, and 11 are inscribed on the arc of a semi-circle. The law of cosines applied twice gives the answer for x of exactly 7, but the arithmetic is so complex that the...
Is it possible to arrange six pencils such that each one touches the other five? If so, how? This is an adaption of a Martin Gardner puzzle only I changed it from cigarettes to pencils and left out the clues because PF folks don’t need clues. From the book “My Best Mathematical and Logic Puzzles”. Dover, 1994.
Thread 'Imaginary Pythagoras'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...

Similar threads

Replies
7
Views
2K
Replies
4
Views
2K
Replies
1
Views
2K
Replies
3
Views
3K
Replies
8
Views
3K
Replies
2
Views
4K
Replies
3
Views
2K
Back
Top