A180969 Array read by antidiagonals: a(k,n) = natural numbers each repeated 2^k times.
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, 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, 5, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 12, 5, 2, 1, 0, 0, 0, 0
Offset: 0
Examples
Sequence gives the antidiagonals of the infinite square array with rows indexed by k and columns indexed by n: 0 1 2 3 4 5 6 7 8 9 10 11 12 13... 0 0 1 1 2 2 3 3 4 4 5 5 6... 0 0 0 0 1 1 1 1 2 2 2 2 3... 0 0 0 0 0 0 0 0 1 1 1 1 1... 0 0 0 0 0 0 0 0 0 0 0 0 0... ...........................................
Links
- Danny Rorabaugh, Table of n, a(n) for n = 0..10000
Programs
-
MATLAB
function v=A180969(k,n,q) % n=vector of natural numbers 0,1,...,n % v=vector in which each n is repeated k times % q=q-th term of v from where to start if k==0;v=n+q;return;end v=A180969(k-1,n,q); % calculate repetition only if v terms are not all zeros if any(v); v=v/2+((-1).^v-1)/4;end % Adriano Caroli, Nov 28 2010
-
Mathematica
Table[Floor[#/2^k] &[n - k], {n, 0, 12}, {k, 0, n}] // Flatten (* Michael De Vlieger, Sep 30 2019 *)
-
PARI
matrix(10, 20, k, n, k--; n--; floor(n/2^k)) \\ Michel Marcus, Sep 09 2019
Formula
a(k,n) = (n/2^k) + Sum_{j=1..k} ((-1)^a(j-1,n) - 1)/2^(k-j+2).
a(k,n) = floor(n/2^k). - Adriano Caroli, Sep 30 2019
Comments