Nine Billion Names Of God
I don’t remember how the subject came up, but Rachel and I were talking about the old Arthur Clarke story. Still a good yarn, but the amusing part to me now is that what back then could’ve plausibly taken two engineers to build, and three months to run, is now a six-line comp 101 exercise:
#!/usr/bin/perl -w
my $count = 0;
for (my $name = 'a'; $name lt 'zzzzzzzzz'; $name++) {
next if $name =~ m/(.)\1\1\1/;
# print "$name\n";
$count++;
}
print "God has $count names. Enjoy the end of the world.\n";
(I know, I know, there’s probably a more efficient way to handle the no-more-than-three-repeating-letters rule than that clunky regexp. But this was just for yucks, during my morning coffee.)