A181940 a(0)=0, and there are a(n) terms between a(n) and the nearest a(n)+1.
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, 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, 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
Offset: 0
Keywords
Examples
From _Peter Luschny_, May 30 2020: (Start) Seen as a triangle: [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, 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, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10] (End)
Programs
-
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)}
-
Python
def T(num_rows): L, R = [0], [0] for n in range(1, num_rows): R.reverse() R.insert(0, n) L.extend(R) return L print(T(14)) # Peter Luschny, May 30 2020
Formula
a(A000217(n))=n.