[seqfan] Re: Can we write this definition in a better way?

M. F. Hasler seqfan at hasler.fr
Mon Sep 30 00:38:19 CEST 2019


Dear Ali & SeqFans:
I also found this sequence interesting,
but I think there is a pattern making the sequence somewhat trivial to
compute.
If we consider the sequence as a table of rows of length = max(2n-1,1),
n=0,1...
then, starting with row n=5 : (i.e., starting with a(18)=1)
- all rows start with 1, and there are no other 1's,
- the even rows are of the form
 (1, 2n-4, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, ...,
2,3, 2n-3)
  where the terms between (1,2n-4) and (2,3, 2n-3) are [ (2k+1, 2k),
k=1..2n-3 ]
- the odd rows are of the form
  (1, 2, 2n-2, 4, 5, 3, 4, 8, 9, 7, 8, 12, 13, 11, 12, 16, 17, 15, 16,...,
3, 2n-4)
  where the terms between 2n-2 and (3, 2n-4) follow the simple pattern [
(4k, 4k+1, 4k-1, 4k), k=1..2n-6 ].

A327759 = [1, /* row n=0 */
2,  /* row n=1, from here on, length=2n-1 */
2, 3, 1,  /*  n=2 */
2, 1, 4, 5, 1,  /* n=3 */
2, 4, 1, 5, 1, 2, 5, /* n=4 */
1, 2, 8, 4, 5, 3, 4, 3, 6, /* n=5 */
1, 8, 3, 2, 5, 4, 7, 6, 2, 3, 9,  /* n=6 */
1, 2, 12, 4, 5, 3, 4, 8, 9, 7, 8, 3, 10, /* n=7*/
1, 12, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 2, 3, 13, /* n=8 */
1, 2, 16, 4, 5, 3, 4, 8, 9, 7, 8, 12, 13, 11, 12, 3, 14,  /* n=9 */
1, 16, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 2, 3, 17,  /* n=10
*/
1, 2, 20, 4, 5, 3, 4, 8, 9, 7, 8, 12, 13, 11, 12, 16, 17, 15, 16, 3, 18,
/* n=11 */
1, 20, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 2,
3, 21,  /* n=12 */
1, 2, 24, 4, 5, 3, 4, 8, 9, 7, 8, 12, 13, 11, 12, 16, 17, 15, 16, 20, 21,
19, 20, 3, 22,  /* n=13 */
1, 24, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21,
20, 23, 22, 2, 3, 25,    /* n=14 */
1, 2, 28, 4, 5, 3, 4, 8, 9, 7, 8, 12, 13, 11, 12, 16, 17, 15, 16, 20, 21,
19, 20, 24, 25, 23, 24, 3, 26,    /* n=15 */
1, 28, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21,
20, 23, 22, 25, 24, 27, 26, 2, 3, 29,    /* n=16 */
1, 2, 32, 4, 5, 3, 4, 8, 9, 7, 8, 12, 13, 11, 12, 16, 17, 15, 16, 20, 21,
19, 20, 24, 25, 23, 24, 28, 29, 27, 28, 3, 30,    /* n=17 */
1, 32, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21,
20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 2, 3, 33,    /* n=18 */
1, 2, 36, 4, 5, 3, 4, 8, 9, 7, 8, 12, 13, 11, 12, 16, 17, 15, 16, 20, 21,
19, 20, 24, 25, 23, 24, 28, 29, 27, 28, 32, 33, 31, 32, 3, 34,    /* n=19
*/
...]
This may be a bit tedious but straightforward to prove.

I also suggest that the simpler triangle mentioned by Chris,
with rows of length 2n, going (1, 3,3, 5,5, ..., 1, 2n-1, 2n), could also
be submitted.

- Maximilian

>> Hi Everyone,
> >>
> >> Please see the sequence below. I just want to see if thereis there is a
> >> better way to write its definition. OEIS editors usually strugglewith my
> >> language, and I would really appreciate it if you could help me
> maketheir
> >> job easier.
> >>
> >> The sequence:
> >>
> >> 1 ,2 ,2 ,3 ,1 ,2 ,1 ,4 ,5 ,1 ,2 ,4 ,1 ,5 ,1 ,2 ,5 ,1 ,2 ,8 ,4,5 ,3 ,4 ,3
> >> ,6 ,1 ,8 ,3 ,2 ,5 ,4 ,7 ,6 ,2 ,3 ,9 ,1 ,2 ,12 ,4 ,5 ,3 ,4 ,8 ,9 ,7,8 ,3
> ,10
> >> ,1 ,12 ,3 ,2 ,5 ,4 ,7 ,6 ,9 ,8 ,11 ,10 ,2 ,3 ,13 ,1 ,2 ,16 ,4 ,5 ,3
> ,4,8 ,9
> >> ,7 ,8 ,12 ,13 ,11 ,12 ,3 ,14 ,1 ,16 ,3 ,2 ,5 ,4 ,7 ,6 ,9 ,8 ,11 ,10 ,13
> >> ,12,15 ,14 ,2 ,3,……
> >>
> >> The definition:
> >> a(1)=1; a(2)=2;
> >> a(n)=n-m1, if a(n-1) is odd;
> >> a(n)=n-m2, if a(n-1) is even;
> >> m1 is the most recent position of the largest term up toa(n-1);
> >> m2 is the most recent position of the second largest term upto a(n-1)
>



More information about the SeqFan mailing list