login
a(0)=0, and there are a(n) terms between a(n) and the nearest a(n)+1.
1

%I #10 May 30 2020 05:06:07

%S 0,1,0,2,0,1,3,1,0,2,4,2,0,1,3,5,3,1,0,2,4,6,4,2,0,1,3,5,7,5,3,1,0,2,

%T 4,6,8,6,4,2,0,1,3,5,7,9,7,5,3,1,0,2,4,6,8,10,8,6,4,2,0,1,3,5,7,9,11,

%U 9,7,5,3,1,0,2,4,6,8,10,12,10,8,6,4,2,0,1,3,5,7,9,11,13,11,9,7,5,3,1,0,2,4,6,8,10,12

%N a(0)=0, and there are a(n) terms between a(n) and the nearest a(n)+1.

%F a(A000217(n))=n.

%e From _Peter Luschny_, May 30 2020: (Start)

%e Seen as a triangle:

%e [0]

%e [1, 0]

%e [2, 0, 1]

%e [3, 1, 0, 2]

%e [4, 2, 0, 1, 3]

%e [5, 3, 1, 0, 2, 4]

%e [6, 4, 2, 0, 1, 3, 5]

%e [7, 5, 3, 1, 0, 2, 4, 6]

%e [8, 6, 4, 2, 0, 1, 3, 5, 7]

%e [9, 7, 5, 3, 1, 0, 2, 4, 6, 8]

%e [10, 8, 6, 4, 2, 0, 1, 3, 5, 7, 9]

%e [11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10]

%e (End)

%o (PARI) a_list(N)={my(a=vector(2*N),c=0);for(i=2,N,a[i]=c++;my(j=i);for(k=1,c-1,a[j-=(-1)^k*(c-k+1)]=c-k);i+=c);vecextract(a,2^N-1)}

%o (Python)

%o def T(num_rows):

%o L, R = [0], [0]

%o for n in range(1, num_rows):

%o R.reverse()

%o R.insert(0, n)

%o L.extend(R)

%o return L

%o print(T(14)) # _Peter Luschny_, May 30 2020

%K nonn

%O 0,4

%A _Eric Angelini_ and _M. F. Hasler_, Apr 03 2012