cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A056023 The positive integers written as a triangle, where row n is written from right to left if n is odd and otherwise from left to right.

Original entry on oeis.org

1, 2, 3, 6, 5, 4, 7, 8, 9, 10, 15, 14, 13, 12, 11, 16, 17, 18, 19, 20, 21, 28, 27, 26, 25, 24, 23, 22, 29, 30, 31, 32, 33, 34, 35, 36, 45, 44, 43, 42, 41, 40, 39, 38, 37, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56
Offset: 1

Views

Author

Clark Kimberling, Aug 01 2000

Keywords

Comments

A triangle such that (1) every positive integer occurs exactly once; (2) row n consists of n consecutive numbers; (3) odd-numbered rows are decreasing; (4) even-numbered rows are increasing; and (5) column 1 is increasing.
Self-inverse permutation of the natural numbers.
T(2*n-1,1) = A000217(2*n-1) = T(2*n,1) - 1; T(2*n,4*n) = A000217(2*n) = T(2*n+1,4*n+1) - 1. - Reinhard Zumkeller, Apr 25 2004
Mirror image of triangle in A056011. - Philippe Deléham, Apr 04 2009
From Clark Kimberling, Feb 03 2011: (Start)
When formatted as a rectangle R, for m > 1, the numbers n-1 and n+1 are neighbors (row, column, or diagonal) of R.
R(n,k) = n + (k+n-2)(k+n-1)/2 if n+k is odd;
R(n,k) = k + (n+k-2)(n+k-1)/2 if n+k is even.
Northwest corner:
1, 2, 6, 7, 15, 16, 28
3, 5, 8, 14, 17, 27, 30
4, 9, 13, 18, 26, 31, 43
10, 12, 19, 25, 32, 42, 49
11, 20, 24, 33, 41, 50, 62
(End)
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers. - Boris Putievskiy, Dec 24 2012
For generalizations see A218890, A213927. - Boris Putievskiy, Mar 10 2013

Examples

			From _Philippe Deléham_, Apr 04 2009 (Start)
Triangle begins:
  1;
  2,   3;
  6,   5,  4;
  7,   8,  9, 10;
  15, 14, 13, 12, 11;
  ...
(End)
Enumeration by boustrophedonic ("ox-plowing") diagonal method. - _Boris Putievskiy_, Dec 24 2012
		

Crossrefs

Programs

  • Mathematica
    (* As a rectangle: *)
    r[n_, k_] := n + (k + n - 2) (k + n - 1)/2/; OddQ[n + k];
    r[n_, k_] := k + (n + k - 2) (n + k - 1)/2/; EvenQ[n+k];
    TableForm[Table[f[n, k], {n, 1, 10}, {k, 1, 15}]]
    Table[r[n - k + 1, k], {n, 14}, {k, n, 1, -1}]//Flatten
    (* Clark Kimberling, Feb 03 2011 *)
    Module[{nn=15},If[OddQ[Length[#]],Reverse[#],#]&/@TakeList[Range[ (nn(nn+1))/2],Range[nn]]]//Flatten (* Harvey P. Dale, Feb 08 2022 *)

Formula

T(n, k) = (n^2 - (n - 2*k)*(-1)^(n mod 2))/2 + n mod 2. - Reinhard Zumkeller, Apr 25 2004
a(n) = ((i + j - 1)*(i + j - 2) + ((-1)^t + 1)*j - ((-1)^t - 1)*i)/2, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n and t=floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 24 2012

Extensions

Name edited by Andrey Zabolotskiy, Apr 16 2023

A056011 Enumeration of natural numbers by the boustrophedonic diagonal method.

Original entry on oeis.org

1, 3, 2, 4, 5, 6, 10, 9, 8, 7, 11, 12, 13, 14, 15, 21, 20, 19, 18, 17, 16, 22, 23, 24, 25, 26, 27, 28, 36, 35, 34, 33, 32, 31, 30, 29, 37, 38, 39, 40, 41, 42, 43, 44, 45, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66
Offset: 1

Views

Author

Clark Kimberling, Aug 01 2000

Keywords

Comments

A triangle such that (1) every positive integer occurs exactly once; (2) row n consists of n consecutive numbers; (3) odd-numbered rows are increasing; and (4) even-numbered rows are decreasing.
Self-inverse permutation of the natural numbers.
Mirror image of triangle in A056023. - Philippe Deléham, Apr 04 2009
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers. - Boris Putievskiy, Dec 24 2012
For generalizations see A218890, A213927. - Boris Putievskiy, Mar 10 2013

Examples

			The start of the sequence as a table:
   1,  3,  4, 10, 11, 21, ...
   2,  5,  9, 12, 20, 23, ...
   6,  8, 13, 19, 24, 34, ...
   7, 14, 18, 25, 33, 40, ...
  15, 17, 26, 32, 41, 51, ...
  ...
Enumeration by boustrophedonic ("ox-plowing") diagonal method. - _Boris Putievskiy_, Dec 24 2012
The start of the sequence as triangle array read by rows:
   1;
   3,  2;
   4,  5,  6;
  10,  9,  8,  7;
  11, 12, 13, 14, 15;
  ...
		

Crossrefs

Cf. A079826, A131179 (first column), A218890, A213927.

Programs

  • Haskell
    a056011 n = a056011_tabl !! (n-1)
    a056011_list = concat a056011_tabl
    a056011_tabl = ox False a000027_tabl where
      ox turn (xs:xss) = (if turn then reverse xs else xs) : ox (not turn) xss
    a056011_row n = a056011_tabl !! (n-1)
    -- Reinhard Zumkeller, Nov 08 2013
  • Maple
    A056011 := proc(n,k)
            if type(n,'even') then
                    A131179(n)-k+1 ;
            else
                    A131179(n)+k-1 ;
            end if;
    end proc: # R. J. Mathar, Sep 05 2012
  • Mathematica
    Flatten[If[EvenQ[Length[#]],Reverse[#],#]&/@Table[c=(n(n+1))/2;Range[ c-n+1,c],{n,20}]] (* Harvey P. Dale, Mar 25 2012 *)
    With[{nn=20},{#[[1]],Reverse[#[[2]]]}&/@Partition[ TakeList[ Range[ (nn(nn+1))/2],Range[nn]],2]//Flatten] (* Harvey P. Dale, Oct 05 2021 *)

Formula

a(n) = ((i+j-1)*(i+j-2)+((-1)^t+1)*i - ((-1)^t-1)*j)/2, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 24 2012

Extensions

New name from Peter Luschny, Apr 15 2023, based on Boris Putievskiy's comment
Showing 1-2 of 2 results.