%I #16 Sep 19 2020 23:57:44
%S 0,1,7,42,295,2675,31122,447188,7661370,152415765,3452271185,
%T 87693358654,2468455488681,76256200336407,2564715882332660,
%U 93281313241869480,3647955866777821668,152635100350763019705,6803550294289868214315,321844061970058547739730,16103630469426364324556635
%N a(n) = Sum_{1 <= m <= n} Sum_{1 <= k <= n+1-m} m*R(k,n+1), where R(k,b) = (b^k - 1)/(b - 1) is the base-b repunit of length k.
%C This is the sum of all elements of a triangular matrix (of size n given by the index) where the k-th diagonal is filled with k-repdigits (in base n+1, as to have digits up to n) of increasing length, as in
%C ( 1 0 0 . . . . . . . . 0 )
%C ( 2 11 0 : )
%C ( 3 22 111 ˙ · . : )
%C ( : 33 222 ˙ · . ˙ · . : )
%C ( : ˙ · . ˙ · . ˙ · . 0 )
%C ( n . . . . . 3..3 2...2 1....1 )
%C with numbers written in base n+1.
%e a(2) = 2 + 1 + 11[3] = 3 + 4 = 7.
%e a(3) = 3 + 2 + 22[4] + 1 + 11[4] + 111[4] = 6 + 15 + 21 = 42.
%e a(4) = 4 + 3 + 33[5] + 2 + 22[5] + 222[5] + 1 + 11[5] + 111[5] + 1111[5] = 10 + 36 + 93 + 156 = 295.
%t a[n_] := Sum[(n + 1 - m)*((n + 1)*((n + 1)^m - 1) - m*n)/n^2, {m, 1, n}]; Array[a, 21, 0] (* _Amiram Eldar_, Aug 24 2020 *)
%o (PARI) apply( {A332082(n)=sum(m=1,n,(n+1-m)*((n+1)*((n+1)^m-1)-m*n)\n^2)}, [0..20])
%Y For base 10 repunits and repdigits, cf. A002275 (repunits), A010785 (repdigits) and A014824 (partial sums of repunits).
%K nonn,base
%O 0,3
%A _M. F. Hasler_, Aug 19 2020