02 March 2022 02:54:59 PM
SUBSET_TEST
C version
Test the SUBSET library.
ASM_ENUM_TEST
ASM_ENUM returns the number of alternating sign
matrices of a given order.
0 1
1 1
2 2
3 7
4 42
5 429
6 7436
7 218348
ASM_TRIANGLE_TEST
ASM_TRIANGLE returns a row of the alternating sign
matrix triangle.
0 1
1 1 1
2 2 3 2
3 7 14 14 7
4 42 105 135 105 42
5 429 1287 2002 2002 1287 429
6 7436 26026 47320 56784 47320 26026 7436
7 218348 873392 1813968 2519400 2519400 1813968 873392 218348
BELL_TEST
BELL computes Bell numbers.
N exact C(I) computed C(I)
0 1 1
1 1 1
2 2 2
3 5 5
4 15 15
5 52 52
6 203 203
7 877 877
8 4140 4140
9 21147 21147
10 115975 115975
CATALAN_TEST
CATALAN computes Catalan numbers.
N exact C(I) computed C(I)
0 1 1
1 1 1
2 2 2
3 5 5
4 14 14
5 42 42
6 132 132
7 429 429
8 1430 1430
9 4862 4862
10 16796 16796
CATALAN_ROW_NEXT_TEST
CATALAN_ROW_NEXT computes a row of the Catalan triangle.
First, compute row 7:
7 1 7 27 75 165 297 429 429
Now compute rows consecutively, one at a time:
0 1
1 1 1
2 1 2 2
3 1 3 5 5
4 1 4 9 14 14
5 1 5 14 28 42 42
6 1 6 20 48 90 132 132
7 1 7 27 75 165 297 429 429
8 1 8 35 110 275 572 1001 1430 1430
9 1 9 44 154 429 1001 2002 3432 4862 4862
10 1 10 54 208 637 1638 3640 7072 11934 16796 16796
CFRAC_TO_RAT_TEST
CFRAC_TO_RAT continued fraction => fraction.
Regular fraction is 4096/15625
Continued fraction coefficients:
0 0
1 3
2 1
3 4
4 2
5 1
6 1
7 11
8 13
The continued fraction convergents.
The last row contains the value of the continued
fraction, written as a common fraction.
I, P(I), Q(I), P(I)/Q(I)
0 0 1 0
1 1 3 0.333333
2 1 4 0.25
3 5 19 0.263158
4 11 42 0.261905
5 16 61 0.262295
6 27 103 0.262136
7 313 1194 0.262144
8 4096 15625 0.262144
CFRAC_TO_RFRAC_TEST
CFRAC_TO_RFRAC: continued fraction to ratio;
Rational polynomial fraction coefficients:
P: 1 1 2
Q: 1 3 1 1
Continued fraction coefficients:
0 1.000000
1 0.500000
2 1.333333
3 -0.500000
4 -1.500000
5 2.000000
Recovered rational polynomial:
P: 1 1 2
Q: 1 3 1 1
CHANGE_GREEDY_TEST
CHANGE_GREEDY makes change using the biggest
coins first.
The total for which change is to be made: 73
The available coins are:
1
5
10
25
50
100
The number of coins in change is: 6
4 2 2 0 0 0
73 50 10 10 1 1 1
CHANGE_NEXT_TEST
CHANGE_NEXT displays the next possible way to make
change for a given total
The total for which change is to be made: 50
The available coins are:
1
5
10
25
50
100
1 50
2 25 25
3 25 10 10 5
4 25 10 10 1 1 1 1 1
5 25 10 5 5 5
6 25 10 5 5 1 1 1 1 1
7 25 10 5 1 1 1 1 1 1 1 1 1 1
8 25 10 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
9 25 5 5 5 5 5
10 25 5 5 5 5 1 1 1 1 1
CHINESE_CHECK_TEST
CHINESE_CHECK checks a set of moduluses for use with the
Chinese Remainder representation.
Modulus set #1:
0 1
1 3
2 8
3 25
IERROR = 0
Modulus set #2:
0 1
1 3
2 -8
3 25
IERROR = 1
Modulus set #3:
0 1
1 3
2 1
3 25
IERROR = 2
Modulus set #4:
0 1
1 3
2 8
3 24
IERROR = 3
CHINESE_TO_I4_TEST
CHINESE_TO_I4 computes an integer with the given
Chinese Remainder representation.
The moduli:
0 3
1 4
2 5
3 7
The number being analyzed is 37
The remainders:
0 1
1 1
2 2
3 2
The reconstructed number is 37
The remainders of the reconstructed number are:
0 1
1 1
2 2
3 2
COMB_NEXT_TEST
COMB_NEXT produces combinations.
Combinations of size K = 1
0
1
2
3
4
5
Combinations of size K = 2
0 1
0 2
0 3
0 4
0 5
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
4 5
Combinations of size K = 3
0 1 2
0 1 3
0 1 4
0 1 5
0 2 3
0 2 4
0 2 5
0 3 4
0 3 5
0 4 5
1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5
Combinations of size K = 4
0 1 2 3
0 1 2 4
0 1 2 5
0 1 3 4
0 1 3 5
0 1 4 5
0 2 3 4
0 2 3 5
0 2 4 5
0 3 4 5
1 2 3 4
1 2 3 5
1 2 4 5
1 3 4 5
2 3 4 5
Combinations of size K = 5
0 1 2 3 4
0 1 2 3 5
0 1 2 4 5
0 1 3 4 5
0 2 3 4 5
1 2 3 4 5
COMB_ROW_NEXT_TEST
COMB_ROW_NEXT computes the next row of the Pascal triangle.
0 1
1 1 1
2 1 2 1
3 1 3 3 1
4 1 4 6 4 1
5 1 5 10 10 5 1
6 1 6 15 20 15 6 1
7 1 7 21 35 35 21 7 1
8 1 8 28 56 70 56 28 8 1
9 1 9 36 84 126 126 84 36 9 1
10 1 10 45 120 210 252 210 120 45 10 1
COMB_UNRANK_TEST
COMB_UNRANK returns a combination of N things
out of M, given the lexicographic rank.
The total set size is M = 10
The subset size is N = 5
The number of combinations of N out of M is 252
Rank Combination
1 1 2 3 4 5