Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #37 Jan 13 2025 17:02:10
%S 1,2,1,1,2,1,2,3,2,1,2,2,3,2,1,3,3,4,3,2,1,1,4,2,4,3,2,1,2,1,3,5,4,3,
%T 2,1,2,2,4,2,5,4,3,2,1,3,3,5,3,6,5,4,3,2,1,2,2,3,4,2,6,5,4,3,2,1,3,3,
%U 4,5,3,7,6,5,4,3,2,1,3,4,5,6,4,2,7,6,5,4,3,2,1
%N Triangle read by rows: sum of digits of n in base k, for 2<=k<=n.
%H Reinhard Zumkeller, <a href="/A240236/b240236.txt">Rows n = 2..100 of triangle, flattened</a>
%F T(n,k) = n - (k - 1) * Sum_{i=1..floor(log_k(n))} floor(n/k^i). - _Ridouane Oudra_, Sep 27 2024
%e Triangle starts:
%e 1
%e 2 1
%e 1 2 1
%e 2 3 2 1
%e 2 2 3 2 1
%e 3 3 4 3 2 1
%t Table[Total[Flatten[IntegerDigits[n,k]]],{n,20},{k,2,n}]//Flatten (* _Harvey P. Dale_, Jan 13 2025 *)
%o (PARI) T(n,k) = local(r=0);if(k<2,-1,while(n>0,r+=n%k;n\=k);r)
%o (Haskell)
%o a240236 n k = a240236_tabl !! (n-1) !! (k-1)
%o a240236_row n = a240236_tabl !! (n-1)
%o a240236_tabl = zipWith (map . flip q)
%o [2..] (map tail $ tail a002260_tabl) where
%o q b n = if n < b then n else q b n' + d where (n', d) = divMod n b
%o -- _Reinhard Zumkeller_, Apr 29 2015
%Y Row sums give A043306.
%Y Cf. A000120, A053735, A053737, A007953.
%Y See A138530 for another version.
%Y Cf. A002260.
%K nonn,tabl,base,changed
%O 2,2
%A _Franklin T. Adams-Watters_, Apr 02 2014