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

Ali Sada pemd70 at yahoo.com
Sun Sep 22 19:21:03 CEST 2019


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)”

 

Example 1: When n=10, a(9) is odd, the largest term up to thatpoint is 5. The most recent position of 5 is 9. a(10)=10-9=1

Example 2: When n=17, a(16) is even. The second largest termup to that point is 4. The most recent position of 4 is 12. a(17)=17-12=5

Thank you very much in advance.

 

Best,

 

Ali 




More information about the SeqFan mailing list