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.

A056011 Enumeration of natural numbers by the boustrophedonic diagonal method.

This page as a plain text file.
%I A056011 #47 Feb 16 2025 08:32:43
%S A056011 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,
%T A056011 27,28,36,35,34,33,32,31,30,29,37,38,39,40,41,42,43,44,45,55,54,53,52,
%U A056011 51,50,49,48,47,46,56,57,58,59,60,61,62,63,64,65,66
%N A056011 Enumeration of natural numbers by the boustrophedonic diagonal method.
%C A056011 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.
%C A056011 Self-inverse permutation of the natural numbers.
%C A056011 Mirror image of triangle in A056023. - _Philippe Deléham_, Apr 04 2009
%C A056011 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
%C A056011 For generalizations see A218890, A213927. - _Boris Putievskiy_, Mar 10 2013
%H A056011 Reinhard Zumkeller, <a href="/A056011/b056011.txt">Rows n = 1..125 of table, flattened</a>
%H A056011 Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations Integer Sequences And Pairing Functions</a>, arXiv:1212.2732 [math.CO], 2012.
%H A056011 Eric W. Weisstein, <a href="https://mathworld.wolfram.com/PairingFunction.html">MathWorld: Pairing functions</a>
%H A056011 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A056011 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
%e A056011 The start of the sequence as a table:
%e A056011    1,  3,  4, 10, 11, 21, ...
%e A056011    2,  5,  9, 12, 20, 23, ...
%e A056011    6,  8, 13, 19, 24, 34, ...
%e A056011    7, 14, 18, 25, 33, 40, ...
%e A056011   15, 17, 26, 32, 41, 51, ...
%e A056011   ...
%e A056011 Enumeration by boustrophedonic ("ox-plowing") diagonal method. - _Boris Putievskiy_, Dec 24 2012
%e A056011 The start of the sequence as triangle array read by rows:
%e A056011    1;
%e A056011    3,  2;
%e A056011    4,  5,  6;
%e A056011   10,  9,  8,  7;
%e A056011   11, 12, 13, 14, 15;
%e A056011   ...
%p A056011 A056011 := proc(n,k)
%p A056011         if type(n,'even') then
%p A056011                 A131179(n)-k+1 ;
%p A056011         else
%p A056011                 A131179(n)+k-1 ;
%p A056011         end if;
%p A056011 end proc: # _R. J. Mathar_, Sep 05 2012
%t A056011 Flatten[If[EvenQ[Length[#]],Reverse[#],#]&/@Table[c=(n(n+1))/2;Range[ c-n+1,c],{n,20}]] (* _Harvey P. Dale_, Mar 25 2012 *)
%t A056011 With[{nn=20},{#[[1]],Reverse[#[[2]]]}&/@Partition[ TakeList[ Range[ (nn(nn+1))/2],Range[nn]],2]//Flatten] (* _Harvey P. Dale_, Oct 05 2021 *)
%o A056011 (Haskell)
%o A056011 a056011 n = a056011_tabl !! (n-1)
%o A056011 a056011_list = concat a056011_tabl
%o A056011 a056011_tabl = ox False a000027_tabl where
%o A056011   ox turn (xs:xss) = (if turn then reverse xs else xs) : ox (not turn) xss
%o A056011 a056011_row n = a056011_tabl !! (n-1)
%o A056011 -- _Reinhard Zumkeller_, Nov 08 2013
%Y A056011 Cf. A079826, A131179 (first column), A218890, A213927.
%Y A056011 Cf. A000027, A038722.
%K A056011 nonn,tabl,nice,easy
%O A056011 1,2
%A A056011 _Clark Kimberling_, Aug 01 2000
%E A056011 New name from _Peter Luschny_, Apr 15 2023, based on _Boris Putievskiy_'s comment