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.

A006282 Sorting numbers: number of comparisons in Batcher's parallel sort.

This page as a plain text file.
%I A006282 M2447 #34 Apr 16 2025 03:02:19
%S A006282 0,1,3,5,9,12,16,19,26,31,37,41,48,53,59,63,74,82,91,97,107,114,122,
%T A006282 127,138,146,155,161,171,178,186,191,207,219,232,241,255,265,276,283,
%U A006282 298,309,321,329,342,351,361,367,383,395,408,417,431,441,452,459,474
%N A006282 Sorting numbers: number of comparisons in Batcher's parallel sort.
%D A006282 R. W. Floyd and D. E. Knuth, The Bose-Nelson sorting problem, pp. 163-172 of J. N. Srivastava, ed., A Survey of Combinatorial Theory, North-Holland, 1973.
%D A006282 D. E. Knuth, Art of Computer Programming, Vol. 3, Sect. 5.3.4, Eq. (10).
%D A006282 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A006282 T. D. Noe, <a href="/A006282/b006282.txt">Table of n, a(n) for n = 1..1000</a>
%H A006282 J.-P. Allouche and Jeffrey Shallit, <a href="https://www.cs.uwaterloo.ca/~shallit/Papers/as0.ps">The ring of k-regular sequences</a>, preprint.
%H A006282 J.-P. Allouche and Jeffrey Shallit, <a href="https://doi.org/10.1016/0304-3975(92)90001-V">The ring of k-regular sequences</a>, Theoretical Computer Sci., Vol. 98 (1992), pp. 163-197.
%H A006282 <a href="/index/So#sorting">Index entries for sequences related to sorting</a>
%F A006282 a(1)=0, a(n) = a(ceiling(n/2)) + a(floor(n/2)) + C(ceiling(n/2), floor(n/2)), n > 1, where the C function is defined in Knuth by C(m,n) = m*n if m*n <= 1 and C(m,n) = C(ceiling(m/2),ceiling(n/2)) + C(floor(m/2),floor(n/2)) + floor((m+n-1)/2) otherwise.
%e A006282 G.f. = x^2 + 3*x^3 + 5*x^4 + 9*x^5 + 12*x^6 + 16*x^7 + 19*x^8 + 26*x^9 + 31*x^10 + ...
%t A006282 c[m_, n_] /; m*n <= 1 = m*n; c[m_, n_] := c[m, n] = c[ Ceiling[m/2], Ceiling[n/2] ] + c[ Floor[m/2], Floor[n/2] ] + Floor[(m + n - 1)/2]; a[1] = 0; a[n_] := a[n] = a[ Ceiling[n/2] ] + a[ Floor[n/2] ] + c[ Ceiling[n/2], Floor[n/2] ]; Table[ a[n], {n, 1, 57}] (* _Jean-François Alcover_, Jan 19 2012, from formula *)
%o A006282 (PARI) (c(m, n) = local(i, j); i=ceil(m/2); j=ceil(n/2); if( m*n<2, m*n, c(i, j) + c(m\2, n\2) + (m+n-1)\2)); {a(n) = local(i, j); i=ceil(n/2); j=floor(n/2); if( n<2, 0, a(i) + a(j) + c(i, j))}; /* _Michael Somos_, Feb 07 2004 */
%Y A006282 Cf. A003075.
%Y A006282 First differences are in A083742.
%K A006282 nonn,easy,nice
%O A006282 1,3
%A A006282 _N. J. A. Sloane_