Find out whether this sequence can be obtained in this particular order:Each number from 1...

Maliyah Robles

Maliyah Robles

Answered

2022-07-14

Find out whether this sequence can be obtained in this particular order:
Each number from 1 to 2021 occurs twice (1,1,2,2,3,3,....so on). Can we arrange it in such a way that between first occurrence and second occurrence of k there are exactly k numbers?
I can see that numbers 1,1,2,2,3,3 can be arranged like 312132. But I am not able to proceed any further. Please help me here as early as possible. Thank you in advance.

Answer & Explanation

toriannucz

toriannucz

Expert

2022-07-15Added 16 answers

Step 1
Such a Langford sequence can not exist for n 1 ( mod 4 ) or for n 2 ( mod 4 ).
To see this, for each number k { 1 , 2 , 3 , , n } define P k as the position of the first occurrence of k in the sequence.Per the required condition on our sequence, it follows that P k + k + 1 will be the position of the second occurrence of k in the sequence.
Now... if we were to add up all of the indices of the positions of each number in our sequence, on the one hand adding up the positions of the 1's followed by the positions of the 2's followed by the positions of the 3's and so on... we will have
k = 1 n ( P k + P k + k + 1 ) = 1 2 n ( n + 3 ) + 2 k = 1 n P k
On the other hand we could have just added up the indices from left to right within the sequence which is of course k = 1 2 n k = n ( 2 n + 1 )
Step 2
Now... since both expressions count the sum of the indices they must be equal, and must of course be integers. Let us rearrange the sum so that we have solved for the summation k = 1 n P k . In doing so we are left with: k = 1 n P k = n ( 3 n 1 ) 4
As the summation is a sum of integers, it follows that the RHS must be an integer as well. This happens if and only if n 0 ( mod 4 ) or n 3 ( mod 4 ).
As a result, since 2021 1 ( mod 4 ) it follows that no such Langford sequence can exist.
This proved the necessity of the condition that n 0 ( mod 4 ) or n 3 ( mod 4 ) for the existence of a Langford sequence. It turns out the condition is sufficient as well. For the sufficiency, follow links in the earlier mentioned wiki article.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get your answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?