%I #158 Sep 29 2024 23:46:23
%S 0,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,
%T 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,
%U 2,3,4,5,6,7,8,9,10,11,0,1,2,3,4,5,6,7,8,9,10,11,12,0,1,2,3,4,5,6,7,8,9,10,11,12,13
%N Triangle read by rows: T(n,k) = k, 0 <= k <= n, in which row n lists the first n+1 nonnegative integers.
%C The point with coordinates (x = A025581(n), y = A002262(n)) sweeps out the first quadrant by upwards antidiagonals. _N. J. A. Sloane_, Jul 17 2018
%C Old name: Integers 0 to n followed by integers 0 to n+1 etc.
%C a(n) = n - the largest triangular number <= n. - _Amarnath Murthy_, Dec 25 2001
%C The PARI functions t1, t2 can be used to read a square array T(n,k) (n >= 0, k >= 0) by antidiagonals downwards: n -> T(t1(n), t2(n)). - _Michael Somos_, Aug 23 2002
%C Values x of unique solution pair (x,y) to equation T(x+y) + x = n, where T(k)=A000217(k). - _Lekraj Beedassy_, Aug 21 2004
%C a(A000217(n)) = 0; a(A000096(n)) = n. - _Reinhard Zumkeller_, May 20 2009
%C Concatenation of the set representation of ordinal numbers, where the n-th ordinal number is represented by the set of all ordinals preceding n, 0 being represented by the empty set. - _Daniel Forgues_, Apr 27 2011
%C An integer sequence is nonnegative if and only if it is a subsequence of this sequence. - _Charles R Greathouse IV_, Sep 21 2011
%C a(A195678(n)) = A000040(n) and a(m) <> A000040(n) for m < A195678(n), an example of the preceding comment. - _Reinhard Zumkeller_, Sep 23 2011
%C A sequence B is called a reluctant sequence of sequence A, if B is triangle array read by rows: row number k coincides with first k elements of the sequence A. A002262 is reluctant sequence of 0,1,2,3,... The nonnegative integers, A001477. - _Boris Putievskiy_, Dec 12 2012
%H Charles R Greathouse IV, <a href="/A002262/b002262.txt">Rows n = 0..100, flattened</a>
%H Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations [Of] Integer Sequences And Pairing Functions</a>, arXiv preprint arXiv:1212.2732 [math.CO], 2012.
%H Michael Somos, <a href="/A073189/a073189.txt">Sequences used for indexing triangular or square arrays</a>
%F a(n) = A002260(n) - 1.
%F a(n) = n - (trinv(n)*(trinv(n)-1))/2; trinv := n -> floor((1+sqrt(1+8*n))/2) (cf. A002024); # gives integral inverses of triangular numbers
%F a(n) = n - A000217(A003056(n)) = n - A057944(n). - _Lekraj Beedassy_, Aug 21 2004
%F a(n) = A140129(A023758(n+2)). - _Reinhard Zumkeller_, May 14 2008
%F a(n) = f(n,1) with f(n,m) = if n<m then n else f(n-m,m+1). - _Reinhard Zumkeller_, May 20 2009
%F a(n) = (1/2)*(t - t^2 + 2*n), where t = floor(sqrt(2*n+1) + 1/2) = round(sqrt(2*n+1)). - _Ridouane Oudra_, Dec 01 2019
%F a(n) = ceiling((-1 + sqrt(9 + 8*n))/2) * (1 - ((1/2)*ceiling((1 + sqrt(9 + 8*n))/2))) + n. - _Ryan Jean_, Sep 03 2022
%F G.f.: x*y/((1 - x)*(1 - x*y)^2). - _Stefano Spezia_, Feb 21 2024
%e From _Daniel Forgues_, Apr 27 2011: (Start)
%e Examples of set-theoretic representation of ordinal numbers:
%e 0: {}
%e 1: {0} = {{}}
%e 2: {0, 1} = {0, {0}} = {{}, {{}}}
%e 3: {0, 1, 2} = {{}, {0}, {0, 1}} = ... = {{}, {{}}, {{}, {{}}}} (End)
%e From _Omar E. Pol_, Jul 15 2012: (Start)
%e 0;
%e 0, 1;
%e 0, 1, 2;
%e 0, 1, 2, 3;
%e 0, 1, 2, 3, 4;
%e 0, 1, 2, 3, 4, 5;
%e 0, 1, 2, 3, 4, 5, 6;
%e 0, 1, 2, 3, 4, 5, 6, 7;
%e 0, 1, 2, 3, 4, 5, 6, 7, 8;
%e 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;
%e 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
%e (End)
%p seq(seq(i,i=0..n),n=0..14); # _Peter Luschny_, Sep 22 2011
%p A002262 := n -> n - binomial(floor((1/2)+sqrt(2*(1+n))),2);
%t m[n_]:= Floor[(-1 + Sqrt[8n - 7])/2]
%t b[n_]:= n - m[n] (m[n] + 1)/2
%t Table[m[n], {n, 1, 105}] (* A003056 *)
%t Table[b[n], {n, 1, 105}] (* A002260 *)
%t Table[b[n] - 1, {n, 1, 120}] (* A002262 *)
%t (* _Clark Kimberling_, Jun 14 2011 *)
%t Flatten[Table[k, {n, 0, 14}, {k, 0, n}]] (* _Alonso del Arte_, Sep 21 2011 *)
%t Flatten[Table[Range[0,n], {n,0,15}]] (* _Harvey P. Dale_, Jan 31 2015 *)
%o (PARI) a(n)=n-binomial(round(sqrt(2+2*n)),2)
%o (PARI) t1(n)=n-binomial(floor(1/2+sqrt(2+2*n)),2) /* A002262, this sequence */
%o (PARI) t2(n)=binomial(floor(3/2+sqrt(2+2*n)),2)-(n+1) /* A025581, cf. comment by Somos for reading arrays by antidiagonals */
%o (PARI) concat(vector(15,n,vector(n,i,i-1))) \\ _M. F. Hasler_, Sep 21 2011
%o (PARI) apply( {A002262(n)=n-binomial(sqrtint(8*n+8)\/2,2)}, [0..99]) \\ _M. F. Hasler_, Oct 20 2022
%o (Haskell)
%o a002262 n k = a002262_tabl !! n !! k
%o a002262_row n = a002262_tabl !! n
%o a002262_tabl = map (enumFromTo 0) [0..]
%o a002262_list = concat a002262_tabl
%o -- _Reinhard Zumkeller_, Aug 05 2015, Jul 13 2012, Mar 07 2011
%o (Python)
%o for i in range(16):
%o for j in range(i):
%o print(j, end=", ") # _Mohammad Saleh Dinparvar_, May 13 2020
%o (Python)
%o from math import comb, isqrt
%o def a(n): return n - comb((1+isqrt(8+8*n))//2, 2)
%o print([a(n) for n in range(105)]) # _Michael S. Branicky_, May 07 2023
%Y Cf. A002024, A002260, A004736, A025581, A025675, A025682.
%Y Cf. A025691, A048645, A053186, A053645, A056558, A127324.
%Y As a sequence, essentially same as A048151.
%Y Cf. A060510 (parity).
%K nonn,tabl,easy,nice
%O 0,6
%A Angele Hamel (amh(AT)maths.soton.ac.uk)
%E New name from _Omar E. Pol_, Jul 15 2012
%E Typo in definition fixed by _Reinhard Zumkeller_, Aug 05 2015