How does one calculate over 6 billion names using the letters from a single name, how long would such a feat take, and why does one even going about do such a thing? Read on to find out. 😀
Spoiler alert! 6 billion names are how many alternate JimbobJeffers mathematically exist.
The above code loops through each character of the entered name, randomly picks a letter and concatenates it to the existing string. It also ensures it does not use the same letter twice unless it already exists. I have checked each output for my name, “le717”, and every single one only has two sevens in it, never three. The trick is not checking for the character used, but the index chosen. If the index has been used before, then it will choose a different one. Since the sevens have two different indexes (3 and 5), they are both included and a third is never added. The administrator liked the idea, so he and I worked together to get it implemented.
The next morning, most all the active members had already seen the name scrambling and either loved it or hated it. For fun, I decided to run it on a few names on my end and see the results. One member’s name in particular, JimbobJeffers, produced some really scrambled names. He wondered if it were possible for the code to generate a name containing “Bobjim”. Since I knew it would be a trivial bit of code to write, I said I would try it.
The progress of this code was amazing. While I failed to check the processing speed after I started it, I later started calculating the speed (names processed at the 10 second, 1 minute, and 1 hour levels), current number of names processed, and projected time until completion. A mere 10 minutes after starting, an amazing 64 million names had already been processed. That is a rate of 6.4 million a minute, or roughly 106 thousand a second! 40 minutes after starting, when I formally starting performing logs, I clocked it at 6 million names a minute, or 36 million names an hour. Within an hour, 419 million names had been run, with a projected 15 hours until all 6 billion were processed looking, or 2 AM the next morning. Yikes. I knew it would take a long time, but not that long. 😛
After that, it slowed down drastically. Two hours after starting, it ran at only 54,000 names a minute, or 3,240,000 names an hour, an 11-fold decrease. Within that time, a staggering 419,159,500 names had been generated.
Finally, nearly 4 and a half hours and a CPU priority increase to High (in an attempt to make it run faster) later, it chugged along at 13,000 names an hour, with a projected 49 years remaining for it to calculate the remaining 5,807,484,800 names. Yup, that is totally happening. 😛
At last I killed the code, having processed 419,750,000 names in a few minutes shy of running for 5 hours.
So, what did I learn from this experiment?
- 6 billion is a lot larger number than you might think. 😛
- I brushed up on my factorial and permutation knowledge.
- I had fun doing it.
- Does there exist an alternate JimbobJeffers that goes under the name “Bobjim”? The world may never know.
In case you wanted to try this experiment yourself, I have posted the code used in a GitHub Gist. This was not the most scientific experiment ever, so there may be some flaws in it, but that’s not the point here. 😛
Well that was fun, perhaps a bit too much fun. 😛 Perhaps I should try to calculate the meaning of life next, as another member suggested. After all, if I can get it to run at an constant rate, which ideally is the rate it starts at, such a calculation should “only take a month”. 😛