Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Combinations/PARI-GP/combinations-1.parigp
Normal file
10
Task/Combinations/PARI-GP/combinations-1.parigp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Crv ( k, v, d ) = {
|
||||
if( d == k,
|
||||
print ( vecextract( v , "2..-2" ) )
|
||||
,
|
||||
for( i = v[ d + 1 ] + 1, #v,
|
||||
v[ d + 2 ] = i;
|
||||
Crv( k, v, d + 1 ) ));
|
||||
}
|
||||
|
||||
combRV( n, k ) = Crv ( k, vector( n, X, X-1), 0 );
|
||||
17
Task/Combinations/PARI-GP/combinations-2.parigp
Normal file
17
Task/Combinations/PARI-GP/combinations-2.parigp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
Cr ( c, z, b, n, k ) = {
|
||||
if( z < b, print1( c, " " );
|
||||
if( n>0, Cr( c+1, z , b* k \n, n-1, k - 1 ))
|
||||
,
|
||||
if( n>0, Cr( c+1, z-b, b*(n-k)\n, n-1, k ))
|
||||
);
|
||||
}
|
||||
|
||||
combR( n, k ) = {
|
||||
local(
|
||||
bnk = binomial( n, k ),
|
||||
b11 = bnk * k \ n ); \\binomial( n-1, k-1 )
|
||||
for( z = 0, bnk - 1,
|
||||
Cr( 1, z, b11, n-1, k-1 );
|
||||
print
|
||||
);
|
||||
}
|
||||
25
Task/Combinations/PARI-GP/combinations-3.parigp
Normal file
25
Task/Combinations/PARI-GP/combinations-3.parigp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
Ci( z, b, n, k ) = { local( c = 1 );
|
||||
n--; k--;
|
||||
while( k >= 0 ,
|
||||
if( z < b,
|
||||
print1(c, " ");
|
||||
c++;
|
||||
if( n > 0,
|
||||
b = b*k \ n);
|
||||
n--; k--;
|
||||
,
|
||||
c++;
|
||||
z -= b;
|
||||
b = b*(n-k)\n;
|
||||
n--
|
||||
)
|
||||
);
|
||||
print;
|
||||
}
|
||||
|
||||
combI( n, k ) = {
|
||||
local( bnk = binomial( n, k ),
|
||||
b11 = bnk * k \ n ); \\ binomial( n-1, k-1 )
|
||||
for( z = 0, bnk - 1,
|
||||
Ci(z, b11, n, k ) );
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue