source: git/Tst/Old/binomial.tst @ b35b93

spielwiese
Last change on this file since b35b93 was b35b93, checked in by Olaf Bachmann <obachman@…>, 26 years ago
This commit was generated by cvs2svn to compensate for changes in r1396, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@1397 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 480 bytes
Line 
1proc fak2
2{
3  if (#[1] <= #[2]) { return(#[2]); }
4  return (#[1] * fak2(#[1] -1,#[2]));
5}
6
7proc fak
8{
9  return (fak2(#[1],1));
10}
11
12proc binom
13{
14  if (#[2] == 0) { return(1); }
15  return ( fak2(#[1],#[1]-#[2]+1) / fak(#[2]) );
16}
17// -------------------------------------------------------
18
19int i;
20int j;
21string b;
22for (i=1; i<=5; i=i+1)
23{
24  b = "binomial coefficients " + string(i) + " ";
25  for (j=0; j<=i; j=j+1)
26  {
27    b = b + " " + string(binom(i,j));
28  }
29  b;
30}
31listvar(all);
32$;
Note: See TracBrowser for help on using the repository browser.