Lah numbers: Difference between revisions
m
Improved C++ output
(added Tcl) |
m (Improved C++ output) |
||
Line 162:
<lang cpp>// Reference: https://en.wikipedia.org/wiki/Lah_number#Identities_and_relations
#include <
#include <iomanip>
#include <iostream>
Line 192:
void print_lah_numbers(unsigned_lah_numbers& uln, int n) {
for (int j = 1; j <= n; ++j)
std::cout << std::setw(11) << j;
std::cout << '\n';
for (int i = 1; i <= n; ++i) {
std::cout << std::setw(2) << i << ' ';
for (int j = 1; j <= i; ++j)
std::cout << std::setw(11) << uln.get(i, j);
Line 201 ⟶ 206:
int main() {
unsigned_lah_numbers uln;
▲ std::cout << "Unsigned Lah numbers up to L(12,12):\n";
print_lah_numbers(uln, 12);
std::cout << "Maximum value of L(n,k) where n == 100:\n";
integer max = 0;
for (int k = 0; k <= 100; ++k)
std::cout << max << '\n';
return 0;
Line 217 ⟶ 218:
<pre>
Unsigned Lah numbers up to L(12,12):
n/k 1 2 3 4 5 6 7 8 9 10 11 12
1
2
3
4
5
6
7
8
9
10
11
12 479001600 2634508800 4390848000 3293136000 1317254400 307359360 43908480 3920400 217800 7260 132 1
Maximum value of L(n,k) where n == 100:
44519005448993144810881324947684737529186447692709328597242209638906324913313742508392928375354932241404408343800007105650554669129521241784320000000000000000000000
|