Non-averaging Sequence
Nov 5 · 2 min read
You have to arrange the numbers between 1-N in such a fashion such that if we choose subsequence of length 3 then they should not form Arithmetic Progression.
it means that if we choose ai,aj,ak then

Example
N=10
1 9 5 3 7 2 10 6 4 8here is the list of arrangements for N=1 to N=15.
1;
1, 2;
1, 3, 2;
1, 3, 2, 4;
1, 5, 3, 2, 4;
1, 5, 3, 2, 6, 4;
1, 5, 3, 7, 2, 6, 4;
1, 5, 3, 7, 2, 6, 4, 8;
1, 9, 5, 3, 7, 2, 6, 4, 8;
1, 9, 5, 3, 7, 2, 10, 6, 4, 8;
1, 9, 5, 3, 11, 7, 2, 10, 6, 4, 8;
1, 9, 5, 3, 11, 7, 2, 10, 6, 4, 12, 8;
1, 9, 5, 13, 3, 11, 7, 2, 10, 6, 4, 12, 8;
1, 9, 5, 13, 3, 11, 7, 2, 10, 6, 14, 4, 12, 8;
1, 9, 5, 13, 3, 11, 7, 15, 2, 10, 6, 14, 4, 12, 8;The 2n-th row is the concatenation of row n, after multiplying each term by 2 and subtracting 1, with row n, after multiplying each term by 2.
Example:- 2n=6 so n=3
2n-th row : 1*2-1, 3*2-1, 2*2-1, 1*2, 3*2, 2*2
so the final 2n-th row will be : 1, 5, 3, 2, 6, 4Similarly, The (2n-1)-th row is the concatenation of row n, after multiplying each term by 2 and subtracting 1, with row n-1, after multiplying each term by 2.
Example:- 2n-1=7 so n=4 and n-1=3
(2n-1)-th row : 1*2-1, 3*2-1, 2*2-1, 4*2-1, 1*2, 3*2, 2*2
so the final (2n-1)-th row will be : 1, 5, 3, 7, 2, 6, 4Here is the program for the above logic.
source=https://oeis.org/A088370