A048158 Triangular array T read by rows: T(n,k) = n mod k, for k=1,2,...,n, n=1,2,...
0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 1, 3, 2, 1, 0, 0, 0, 2, 0, 3, 2, 1, 0, 0, 1, 0, 1, 4, 3, 2, 1, 0, 0, 0, 1, 2, 0, 4, 3, 2, 1, 0, 0, 1, 2, 3, 1, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 2, 0, 5, 4, 3, 2, 1, 0, 0, 1, 1, 1, 3, 1, 6, 5, 4, 3, 2, 1, 0, 0, 0, 2, 2, 4, 2, 0, 6, 5, 4, 3, 2, 1, 0
Offset: 1
Examples
Triangle begins 0; 0 0; 0 1 0; 0 0 1 0; 0 1 2 1 0; 0 0 0 2 1 0; 0 1 1 3 2 1 0; 0 0 2 0 3 2 1 0; 0 1 0 1 4 3 2 1 0; 0 0 1 2 0 4 3 2 1 0; 0 1 2 3 1 5 4 3 2 1 0; 0 0 0 0 2 0 5 4 3 2 1 0; ... From _Omar E. Pol_, Feb 21 2014: (Start) Illustration of the 12th row of triangle: ----------------------------------- . k: 1 2 3 4 5 6 7 8 9 10..12 ----------------------------------- . _ _ _ _ _ _ _ _ _ _ _ _ . |_| | | | | | | | | | | | . |_|_| | | | | | | | | | | . |_| |_| | | | | | | | | | . |_|_| |_| | | | | | | | | . |_| | | |_| | | | | | | | . |_|_|_| | |_| | | | | | | . |_| | | | | |_| | | | | | . |_|_| |_| | |*|_| | | | | . |_| |_| | | |* *|_| | | | . |_|_| | |_| |* * *|_| | | . |_| | | |*| |* * * *|_| | . |_|_|_|_|*|_|* * * * *|_| . Row 12 is 0 0 0 0 2 0 5 4 3 2 1 0 (End)
Links
- Alois P. Heinz, Rows n = 1..141, flattened
- Michael Z. Spivey, The Humble Sum of Remainders Function, Mathematics Magazine, Vol. 78, No. 4 (Oct., 2005), pp. 300-305.
- Eric Weisstein's World of Mathematics, Mod.
Crossrefs
Programs
-
Haskell
a048158 = mod a048158_row n = a048158_tabl !! (n-1) a048158_tabl = zipWith (map . mod) [1..] a002260_tabl -- Reinhard Zumkeller, Apr 29 2015, Jan 20 2014 (fixed), Aug 13 2013
-
Maple
T:= (n, k)-> modp(n, k): seq(seq(T(n, k), k=1..n), n=1..20); # Alois P. Heinz, Apr 04 2012
-
Mathematica
Flatten[Table[Mod[n, Range[n]], {n, 15}]]
-
Python
def A048158_T(n,k): return n%k # Chai Wah Wu, May 13 2024
Formula
G.f. for the k-th column: x^(k+1)*Sum_{i=0..k-2} (i + 1)*x^i/(1 - x^k). - Stefano Spezia, May 08 2024
Extensions
More terms from David Wasserman, Oct 01 2008
Comments