Stirling numbers of the first kind: Difference between revisions
Content added Content deleted
m (→{{header|ALGOL W}}: Adjust output to avoid line-wrap) |
m (→{{header|ALGOL 68}}: Adjusted output to avoid line-wrap) |
||
Line 115: | Line 115: | ||
{{works with|ALGOL 68G|Any - tested with release 2.8.3.win32}} |
{{works with|ALGOL 68G|Any - tested with release 2.8.3.win32}} |
||
Uses the Algol 68G LONG LONG INT mode which provides large-precision integers. As the default number of digits is insufficient for the task, the maximum nunber of digits is specified by a pragmatic comment. |
Uses the Algol 68G LONG LONG INT mode which provides large-precision integers. As the default number of digits is insufficient for the task, the maximum nunber of digits is specified by a pragmatic comment. |
||
<syntaxhighlight lang="algol68"> |
<syntaxhighlight lang="algol68"> |
||
BEGIN # show some (unsigned) Stirling numbers of the first kind # |
|||
# specify the precision of LONG LONG INT, we need about 160 digits # |
# specify the precision of LONG LONG INT, we need about 160 digits # |
||
Line 145: | Line 145: | ||
REF[,]SINT s1 = make s1( max stirling, FALSE ); |
REF[,]SINT s1 = make s1( max stirling, FALSE ); |
||
print( ( "Unsigned Stirling numbers of the first kind:", newline ) ); |
print( ( "Unsigned Stirling numbers of the first kind:", newline ) ); |
||
print( ( " k" ) ); |
print( ( " k 0" ) ); |
||
FOR k |
FOR k TO max stirling DO print( ( whole( k, IF k < 6 THEN -10 ELSE -9 FI ) ) ) OD; |
||
print( ( newline, " n", newline ) ); |
print( ( newline, " n", newline ) ); |
||
FOR n FROM 0 TO max stirling DO |
FOR n FROM 0 TO max stirling DO |
||
print( ( whole( n, -2 ) ) ); |
print( ( whole( n, -2 ), whole( s1[ n, 0 ], -3 ) ) ); |
||
FOR k |
FOR k TO n DO |
||
print( ( whole( s1[ n, k ], -10 ) ) ) |
print( ( whole( s1[ n, k ], IF k < 6 THEN -10 ELSE -9 FI ) ) ) |
||
OD; |
OD; |
||
print( ( newline ) ) |
print( ( newline ) ) |
||
Line 167: | Line 167: | ||
print( ( whole( max 100, 0 ), newline ) ) |
print( ( whole( max 100, 0 ), newline ) ) |
||
END |
END |
||
END |
|||
</syntaxhighlight> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Unsigned Stirling numbers of the first kind: |
Unsigned Stirling numbers of the first kind: |
||
k |
k 0 1 2 3 4 5 6 7 8 9 10 11 12 |
||
n |
n |
||
0 |
0 1 |
||
1 |
1 0 1 |
||
2 |
2 0 1 1 |
||
3 |
3 0 2 3 1 |
||
4 |
4 0 6 11 6 1 |
||
5 |
5 0 24 50 35 10 1 |
||
6 |
6 0 120 274 225 85 15 1 |
||
7 |
7 0 720 1764 1624 735 175 21 1 |
||
8 |
8 0 5040 13068 13132 6769 1960 322 28 1 |
||
9 |
9 0 40320 109584 118124 67284 22449 4536 546 36 1 |
||
10 |
10 0 362880 1026576 1172700 723680 269325 63273 9450 870 45 1 |
||
11 |
11 0 3628800 10628640 12753576 8409500 3416930 902055 157773 18150 1320 55 1 |
||
12 |
12 0 39916800 120543840 150917976 105258076 45995730 13339535 2637558 357423 32670 1925 66 1 |
||
Maximum Stirling number of the first kind with n = 100: |
Maximum Stirling number of the first kind with n = 100: |
||
19710908747055261109287881673376044669240511161402863823515728791076863288440277983854056472903481625299174865860036734731122707870406148096000000000000000000 |
19710908747055261109287881673376044669240511161402863823515728791076863288440277983854056472903481625299174865860036734731122707870406148096000000000000000000 |