This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A240236 #41 Aug 26 2025 00:33:51 %S A240236 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 A240236 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 A240236 4,5,3,7,6,5,4,3,2,1,3,4,5,6,4,2,7,6,5,4,3,2,1 %N A240236 Triangle read by rows: sum of digits of n in base k, for 2<=k<=n. %H A240236 Reinhard Zumkeller, <a href="/A240236/b240236.txt">Rows n = 2..100 of triangle, flattened</a> %F A240236 T(n,k) = n - (k - 1) * Sum_{i=1..floor(log_k(n))} floor(n/k^i). - _Ridouane Oudra_, Sep 27 2024 %F A240236 T(n,k) = n - (k - 1) * A090623(n,k). - _Zhuorui He_, Aug 25 2025 %e A240236 Triangle starts: %e A240236 1 %e A240236 2 1 %e A240236 1 2 1 %e A240236 2 3 2 1 %e A240236 2 2 3 2 1 %e A240236 3 3 4 3 2 1 %t A240236 Table[Total[Flatten[IntegerDigits[n,k]]],{n,20},{k,2,n}]//Flatten (* _Harvey P. Dale_, Jan 13 2025 *) %o A240236 (PARI) T(n,k) = local(r=0);if(k<2,-1,while(n>0,r+=n%k;n\=k);r) %o A240236 (PARI) T(n, k) = sumdigits(n, k) \\ _Zhuorui He_, Aug 25 2025 %o A240236 (Haskell) %o A240236 a240236 n k = a240236_tabl !! (n-1) !! (k-1) %o A240236 a240236_row n = a240236_tabl !! (n-1) %o A240236 a240236_tabl = zipWith (map . flip q) %o A240236 [2..] (map tail $ tail a002260_tabl) where %o A240236 q b n = if n < b then n else q b n' + d where (n', d) = divMod n b %o A240236 -- _Reinhard Zumkeller_, Apr 29 2015 %Y A240236 Row sums give A043306. %Y A240236 Cf. A000120, A053735, A053737, A007953. %Y A240236 See A138530 for another version. %Y A240236 Cf. A002260, A090623. %K A240236 nonn,tabl,base,changed %O A240236 2,2 %A A240236 _Franklin T. Adams-Watters_, Apr 02 2014