OFFSET
2,2
LINKS
Reinhard Zumkeller, Rows n = 2..100 of triangle, flattened
FORMULA
T(n,k) = n - (k - 1) * Sum_{i=1..floor(log_k(n))} floor(n/k^i). - Ridouane Oudra, Sep 27 2024
EXAMPLE
Triangle starts:
1
2 1
1 2 1
2 3 2 1
2 2 3 2 1
3 3 4 3 2 1
PROG
(PARI) T(n, k) = local(r=0); if(k<2, -1, while(n>0, r+=n%k; n\=k); r)
(Haskell)
a240236 n k = a240236_tabl !! (n-1) !! (k-1)
a240236_row n = a240236_tabl !! (n-1)
a240236_tabl = zipWith (map . flip q)
[2..] (map tail $ tail a002260_tabl) where
q b n = if n < b then n else q b n' + d where (n', d) = divMod n b
-- Reinhard Zumkeller, Apr 29 2015
CROSSREFS
KEYWORD
AUTHOR
Franklin T. Adams-Watters, Apr 02 2014
STATUS
approved