login
The Blue Comma sequence: Differences of indices of even terms gives back the sequence; lexicographically earliest such permutation of positive integers.
2

%I #13 Dec 21 2024 21:01:06

%S 1,2,4,3,6,5,7,9,8,11,13,10,15,17,19,21,23,12,25,27,29,31,14,33,35,37,

%T 39,41,43,16,45,47,49,51,53,55,57,59,18,61,63,65,67,69,71,73,20,75,77,

%U 79,81,83,85,87,89,91,93,22,95,97,99,101,103,105,107,109,111,113,115,117,24,119,121,123,125,127

%N The Blue Comma sequence: Differences of indices of even terms gives back the sequence; lexicographically earliest such permutation of positive integers.

%H Eric Angelini, <a href="https://cinquantesignes.blogspot.com/2020/05/yellow-commas-pink-red-blue.html">Yellow commas, pink, red, blue...</a>, personal blog "Cinquante signes" on blogspot.com, May 17 2020

%H Eric Angelini, <a href="/A332072/a332072.pdf">Yellow commas, pink, red, blue...</a>, personal blog "Cinquante signes" on blogspot.com, May 17 2020 [Cached copy]

%e The even terms are at indices 2, 3, 5, 9, 12, 18, 23, 30, ...; first differences give 1, 2, 4, 3, 6, 5, 7, ... = the sequence itself.

%o (PARI) upto(N)={my(a=Vec([1,2],N),i=1,L=2); local(U=[2], nxt(e)=while(#U>1&&U[2]==U[1]+1, U=U[^1]); my(t=U[1]); until( t++%2!=e && !setsearch(U,t),); U=setunion(U,[t]);t ); for(n=3,N,a[n]=nxt(n-L==a[i] && i++ && L=n));a}

%Y Cf. A197756 (the Yellow Comma sequence: count digits between odd terms).

%K nonn

%O 1,2

%A _Eric Angelini_ and _M. F. Hasler_, May 19 2020