/* Original version of this file copyright 1999 by Michael Wester,
 * and retrieved from http://www.math.unm.edu/~wester/demos/Combinatorics/problems.macsyma
 * circa 2006-10-23.
 *
 * Released under the terms of the GNU General Public License, version 2,
 * per message dated 2007-06-03 from Michael Wester to Robert Dodier
 * (contained in the file wester-gpl-permission-message.txt).
 *
 * See: "A Critique of the Mathematical Abilities of CA Systems"
 * by Michael Wester, pp 25--60 in
 * "Computer Algebra Systems: A Practical Guide", edited by Michael J. Wester
 * and published by John Wiley and Sons, Chichester, United Kingdom, 1999.
 */
/* ----------[ M a c s y m a ]---------- */
/* ---------- Initialization ---------- */
showtime: all$
prederror: false$
/* ---------- Combinatorial Theory ---------- */
/* Pochhammer symbol (a)_n = a (a + 1) ... (a + n - 1) => a (a + 1) (a + 2) */
pochhammer(a, 3);
/* Binomial coefficient => n (n - 1) (n - 2)/6 */
binomial(n, 3);
/* 2^n n! (2 n - 1)!! => (2 n)! */
declare(n, integer)$
2^n * n! * (2*n - 1)!!;
makefact(%);
ratsimp(subst(ceiling((2*n - 1)/2) = n, %));
remove(n, integer)$
/* 2^n n! product(2 k - 1, k = 1..n) => (2 n)! */
2^n * n! * product(2*k - 1, k, 1, n);
closedform(%);
/* => (2 n)!/[2^(2 n) (n!)^2]   or   (2 n - 1)!!/[2^n n!] */
gamma(n + 1/2)/(sqrt(%pi) * n!);
makegamma(%);
/* Partitions of an integer => {1+1+1+1, 1+1+2, 1+3, 2+2, 4} (5 in all) */
numpartitions(4);
/* Stirling numbers of the first kind: S_1(5, 2) => -50 */
/*stirling1(5, 2);*/
/* Euler's totient function => 576 */
totient(1776);
/* ---------- Quit ---------- */
quit();
