A143182 Triangle T(n,m) = 1 + abs(n-2*m), read by rows, 0<=m<=n.
1, 2, 2, 3, 1, 3, 4, 2, 2, 4, 5, 3, 1, 3, 5, 6, 4, 2, 2, 4, 6, 7, 5, 3, 1, 3, 5, 7, 8, 6, 4, 2, 2, 4, 6, 8, 9, 7, 5, 3, 1, 3, 5, 7, 9, 10, 8, 6, 4, 2, 2, 4, 6, 8, 10, 11, 9, 7, 5, 3, 1, 3, 5, 7, 9, 11, 12, 10, 8, 6, 4, 2, 2, 4, 6, 8, 10, 12, 13, 11, 9, 7, 5, 3, 1, 3, 5, 7, 9, 11, 13
Offset: 0
Examples
From _Boris Putievskiy_, Jan 15 2013: (Start) The start of the sequence as table: 1...2...3...4...5...6...7...8...9..10..11... 2...1...2...3...4...5...6...7...8...9..10... 3...2...1...2...3...4...5...6...7...8...9... 4...3...2...1...2...3...4...5...6...7...8... 5...4...3...2...1...2...3...4...5...6...7... 6...5...4...3...2...1...2...3...4...5...6... 7...6...5...4...3...2...1...2...3...4...5... 8...7...6...5...4...3...2...1...2...3...4... 9...8...7...6...5...4...3...2...1...2...3... 10..9...8...7...6...5...4...3...2...1...2... 11.10...9...8...7...6...5...4...3...2...1... . . . The start of the sequence as triangle array read by rows: (End) 1; 2, 2; 3, 1, 3; 4, 2, 2, 4; 5, 3, 1, 3, 5; 6, 4, 2, 2, 4, 6; 7, 5, 3, 1, 3, 5, 7; 8, 6, 4, 2, 2, 4, 6, 8; 9, 7, 5, 3, 1, 3, 5, 7, 9; 10, 8, 6, 4, 2, 2, 4, 6, 8, 10; 11, 9, 7, 5, 3, 1, 3, 5, 7, 9, 11; . . . Row number r contains r numbers: r, r-2,...3,1,3,...r-2,r if r is odd, r, r-2,...2,2,...r-2,r, if r is even. - _Boris Putievskiy_, Jan 15 2013
Links
- G. C. Greubel, Rows n= 0.100 of triangle, flattened
- Boris Putievskiy, Transformations [Of] Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
Programs
-
GAP
Flat(List([0..15], n-> List([0..n], k-> 1+AbsInt(n-2*k) ))); # G. C. Greubel, Jul 23 2019
-
Magma
[1+Abs(n-2*k): k in [0..n], n in [0..15]]; // G. C. Greubel, Jul 23 2019
-
Mathematica
T[n_, m_]:= 1+Abs[(1+n-m) - (1+m)]; Table[Table[t[n, m], {m,0,n}], {n, 0, 15}]//Flatten
-
PARI
for(n=0,15, for(k=0,n, print1(1+abs(n-2*k), ", "))) \\ G. C. Greubel, Jul 23 2019
-
Sage
[[1+abs(n-2*k) for k in (0..n)] for n in (0..15)] # G. C. Greubel, Jul 23 2019
Formula
Symmetry: T(n,m) = T(n,n-m).
From Boris Putievskiy, Jan 15 2013: (Start)
For the general case
a(n) = |(t+1)^2 - 2n| + m*floor((t^2+3t+2-2n)/(t+1)),
where t = floor((-1+sqrt(8*n-7))/2).
For m = 2
a(n) = |(t+1)^2 - 2n| + 2*floor((t^2+3t+2-2n)/(t+1)),
where t=floor((-1+sqrt(8*n-7))/2). (End)
Extensions
Offset and row sums corrected by R. J. Mathar, Jul 05 2012
Comments