A048151 Triangular array T read by rows: T(n,k)=k mod n, for k=1,2,...,n, n=1,2,...
0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0
Offset: 1
Examples
Triangle begins: 0; 1, 0; 1, 2, 0; 1, 2, 3, 0; 1, 2, 3, 4, 0; ...
Crossrefs
As a sequence, essentially same as A002262.
Programs
-
Mathematica
Flatten[Table[Mod[k,n],{n,15},{k,n}]] (* Harvey P. Dale, Mar 21 2012 *)
-
Python
from math import isqrt, comb def A048151(n): return n-comb((m:=isqrt(k:=n+1<<1))+(k>m*(m+1)),2) # Chai Wah Wu, Apr 09 2025
Formula
G.f.: x^2*y/((1 - x)*(1 - x*y)^2). - Stefano Spezia, Feb 21 2024