login
Table T(n, k) read by antidiagonals upwards: sum of the terms of the continued fraction for the fractional part of n/k (n>=1, k>=1).
2

%I #15 Feb 12 2020 10:27:12

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

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

%U 2,3,4,4,6,7,5,6,6,7,12,0,0,3,2,5,3,0,4,6,4,6,6,13

%N Table T(n, k) read by antidiagonals upwards: sum of the terms of the continued fraction for the fractional part of n/k (n>=1, k>=1).

%H Andrey Zabolotskiy, <a href="/A332342/b332342.txt">Table of n, a(n) for n = 1..4950</a> (antidiagonals 1..99)

%e 2/7 = 1/(3+1/2), so T(2, 7) = 3 + 2 = 5.

%e The table begins:

%e 0 2 3 4 5 6 7 8 9 ...

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

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

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

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

%e 0 0 0 2 5 0 7 4 3 ...

%e ...

%t t[n_,k_] := Total@ ContinuedFraction@ FractionalPart[n/k];

%t Flatten[Table[t[nk+k-1,k], {nk,10}, {k,nk}]]

%o (Python)

%o def cofr(p, q):

%o return [] if q == 0 else [p // q] + cofr(q, p % q)

%o def t(n, k):

%o return sum(cofr(n, k)[1:])

%o tr = []

%o for nk in range(1, 20):

%o for k in range(1, nk+1):

%o tr.append(t(nk+1-k, k))

%o print(tr)

%Y Cf. A332343, A058027, A058299, A071316.

%K nonn,tabl

%O 1,3

%A _Andrey Zabolotskiy_, Feb 10 2020