login
Table read by antidiagonals (n>1, k>0): A(n,k) = leading digit of k in base n.
1

%I #48 Jun 27 2016 12:12:40

%S 1,1,1,1,2,1,1,2,1,1,1,2,3,1,1,1,2,3,1,1,1,1,2,3,4,1,2,1,1,2,3,4,1,1,

%T 2,1,1,2,3,4,5,1,1,2,1,1,2,3,4,5,1,1,2,1,1,1,2,3,4,5,6,1,1,2,1,1,1,2,

%U 3,4,5,6,1,1,1,2,1,1,1,2,3,4,5,6,7,1

%N Table read by antidiagonals (n>1, k>0): A(n,k) = leading digit of k in base n.

%C This is a generalization of A000030.

%C The first occurrence of a number k in the sequence is given by A(k+1,k).

%H Robert Israel, <a href="/A273619/b273619.txt">Table of n, a(n) for n = 2..10012</a> (first 142 antidiagonals, flattened)

%F From _Robert Israel_, May 31 2016: (Start)

%F A(n,k) = floor(k/n^floor(log_n(k))).

%F A(n,k) = k if n > k.

%F A(n,k) = A(n, floor(k/n)) otherwise.

%F G.f. of row n, G_n(x), satisfies G_n(x) = (1-x^n)/(1-x)^2 - (1+(n-1)*x^n)/(1-x) + (1-x^n)*G_n(x^n)/(1-x). (End)

%e First few rows of the array are:

%e 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...

%e 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2...

%e 1, 2, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1...

%e 1, 2, 3, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3...

%e 1, 2, 3, 4, 5, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3...

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

%e 1, 2, 3, 4, 5, 6, 7, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2...

%e Note that the initial row is row 2.

%e A(3,3) corresponds to row n=3 and column k=3, and k=3 is written as 10 in base n=3, and the leading digit of 10 is 1, so A(3,3)=1.

%e A(12,11) corresponds to row n=12 and column k=11, and 11 is written as B in base 12, and the leading and only digit of B is B which is number 11 in decimal, so A(12,11)=11.

%p A:= (n,k) -> floor(k/n^floor(log[n](k))):

%p seq(seq(A(n-k,k),k=1..n-2),n=2..20); # _Robert Israel_, May 31 2016

%t a[n_, k_] := First[IntegerDigits[k, n]];

%o (PARI) T(n,k) = digits(k, n)[1];

%o tabl(10, 10, n, k, n++; T(n,k)); \\ _Michel Marcus_, Jun 12 2016

%Y Cf. A000030 (row 10), A122586 (row 3), A122587 (row 4).

%Y Cf. A051777, A051778 (may be interpreted as arrays of last digits of k in base n).

%K tabl,base,easy,nonn

%O 2,5

%A _Andrey Zabolotskiy_, May 30 2016