login
Array read by antidiagonals: a(k,n) = natural numbers each repeated 2^k times.
11

%I #53 Oct 05 2019 10:51:22

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

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

%U 5,2,1,0,0,0,0,0,0,0,0,12,5,2,1,0,0,0,0

%N Array read by antidiagonals: a(k,n) = natural numbers each repeated 2^k times.

%C Generalization of P. Barry's (2003) formula in A004526.

%H Danny Rorabaugh, <a href="/A180969/b180969.txt">Table of n, a(n) for n = 0..10000</a>

%F a(k,n) = (n/2^k) + Sum_{j=1..k} ((-1)^a(j-1,n) - 1)/2^(k-j+2).

%F a(k,n) = floor(n/2^k). - _Adriano Caroli_, Sep 30 2019

%e Sequence gives the antidiagonals of the infinite square array with rows indexed by k and columns indexed by n:

%e 0 1 2 3 4 5 6 7 8 9 10 11 12 13...

%e 0 0 1 1 2 2 3 3 4 4 5 5 6...

%e 0 0 0 0 1 1 1 1 2 2 2 2 3...

%e 0 0 0 0 0 0 0 0 1 1 1 1 1...

%e 0 0 0 0 0 0 0 0 0 0 0 0 0...

%e ...........................................

%t Table[Floor[#/2^k] &[n - k], {n, 0, 12}, {k, 0, n}] // Flatten (* _Michael De Vlieger_, Sep 30 2019 *)

%o (MATLAB) function v=A180969(k,n,q)

%o % n=vector of natural numbers 0,1,...,n

%o % v=vector in which each n is repeated k times

%o % q=q-th term of v from where to start

%o if k==0;v=n+q;return;end

%o v=A180969(k-1,n,q);

%o % calculate repetition only if v terms are not all zeros

%o if any(v); v=v/2+((-1).^v-1)/4;end

%o % _Adriano Caroli_, Nov 28 2010

%o (PARI) matrix(10, 20, k, n, k--; n--; floor(n/2^k)) \\ _Michel Marcus_, Sep 09 2019

%Y Cf. A001477, A004526, A002265, A132292.

%K easy,nonn,tabl,less

%O 0,4

%A _Adriano Caroli_, Nov 17 2010