7 | 7 |
and we want to produce it using only permutations or combinations,
|
8 | 8 |
with duplicates allowed or not, of _r_ words out of _n_ input words. What
|
9 | 9 |
method and what values of _n_ and _r_ should we get as close to 50,000 words
|
10 | |
(without going under) as possible? (This should exclude trivial solutions
|
11 | |
like P(50000, 1).)
|
|
10 |
(without going under) as possible?
|
|
11 |
|
|
12 |
This should exclude trivial solutions like P(50000, 1). And, assuming this
|
|
13 |
novel will be in "sentences" of _r_ words, what results do we get if we
|
|
14 |
insist on a high _r_?
|
12 | 15 |
|
13 | 16 |
OK so my actualy hypothesis is that I can get a computer to brute-force its
|
14 | 17 |
way through these numbers so I don't have to do anything hard like write
|
|
60 | 63 |
uninteresting text too (kind of like counting in base 15, unless it was
|
61 | 64 |
scrambled up somehow.)
|
62 | 65 |
|
63 | |
Raising _n_ higher results in OverflowErrors (srsly, Python? thought you had
|
64 | |
bignums, dude) but probably wouldn't get us anywhere.
|
|
66 |
After writing some code to catch OverflowErrors (srsly, Python? thought you had
|
|
67 |
bignums, dude) I ran it for _n_ up to 800 and found that P_duplicates(224,2) =
|
|
68 |
50176. OK, also not a surprise given the square root is around 223. Again,
|
|
69 |
not sure how interesting such a text would be, although that may not matter.
|
65 | 70 |
|
66 | 71 |
### C (combinations without repetitions) ###
|
67 | 72 |
|
|
73 | 78 |
When looking at _n_ up to 500, the best result was C_duplicates(316, 2) = 50086.
|
74 | 79 |
Again, not bad.
|
75 | 80 |
|
|
81 |
### Nuts to this! I want bigger _r_'s! ###
|
|
82 |
|
|
83 |
You will note that the value of _r_ in the above results is often 2, which
|
|
84 |
suggests our novel would be a series of pairs of things, which sounds pretty
|
|
85 |
boring no matter which way you slice it. What if we insist _r_ is larger?
|
|
86 |
|
|
87 |
Here are some results for _r_ = 3 and maximum _n_ in all cases is 500:
|
|
88 |
|
|
89 |
$ ./perm-comb-finder.py --minimum-r=3 --top=500
|
|
90 |
best: P(38,3) = 50616
|
|
91 |
best: P(9,9) = 362880
|
|
92 |
best: P_duplicates(15,4) = 50625.0
|
|
93 |
best: C(317,315) = 50086
|
|
94 |
best: C_duplicates(66,3) = 50116
|
|
95 |
|
|
96 |
Interesting to note that the best _r_ for C becomes a whopping 315, but that
|
|
97 |
is just due to the symmetrical nature of C (I blame Pascal's Triangle.)
|
|
98 |
50,086 is still our overall winner, but C_duplicates(66, 3) might arguably be
|
|
99 |
more interesting. Let's try _r_ = 4, 5, and 6:
|
|
100 |
|
|
101 |
$ ./perm-comb-finder.py --minimum-r=4 --top=500
|
|
102 |
best: P(11,5) = 55440
|
|
103 |
best: P(9,9) = 362880
|
|
104 |
best: P_duplicates(15,4) = 50625.0
|
|
105 |
best: C(317,315) = 50086
|
|
106 |
best: C_duplicates(13,7) = 50388
|
|
107 |
|
|
108 |
$ ./perm-comb-finder.py --minimum-r=5 --top=500
|
|
109 |
best: P(11,5) = 55440
|
|
110 |
best: P(9,9) = 362880
|
|
111 |
best: P_duplicates(9,5) = 59049.0
|
|
112 |
best: C(317,315) = 50086
|
|
113 |
best: C_duplicates(13,7) = 50388
|
|
114 |
|
|
115 |
$ ./perm-comb-finder.py --minimum-r=6 --top=500
|
|
116 |
best: P(9,6) = 60480
|
|
117 |
best: P(9,9) = 362880
|
|
118 |
best: P_duplicates(7,6) = 117649.0
|
|
119 |
best: C(317,315) = 50086
|
|
120 |
best: C_duplicates(13,7) = 50388
|
|
121 |
|
|
122 |
Of these, C_duplicates(13,7) might be the most interesting, but technically
|
|
123 |
C(317,315) is still the winner.
|
|
124 |
|
76 | 125 |
Future Work
|
77 | 126 |
-----------
|
78 | 127 |
|