I’ve been reading Science Fiction stories since I was a wee lad. One of my
favorite stories has always been Arthur C. Clarke’s short story The Nine
Billion Names of God (Copyright 1953, Ballantine Books, Inc.). This
exquisite little gem is but 7 pages long -- but its reach within my own psyche
has spanned almost 50 years.
To include a little background from Clarke’s forward in his 1974
reprise anthology "The Nine Billion Names of God" (Signet, The New American Library
Inc.), we learn that this tale was written during a rainy weekend in the
Roosevelt Hotel, NY, in May 1952.
The story-line is quaint: A well-educated Lama from Tibet visits a
high-tech American computer company executive, and arranges a deal whereby
that company will provide a high-speed digital computer and technical services
for his lamasery in the high mountains of Tibet. The Lama explains that the
computer will help them list out all the "Names of God", which are comprised
of all the possible permutations of their special alphabet, the output of any
name always being 9 characters in length. The monks have been at this task "by
hand" for 3 centuries now; and, as the culmination of the manual process is
calculated to take another 15,000 more years of effort, the urbane Lama wishes
to speed up the task a bit by employing modern methods.
The Lama is somewhat vague about their reason for doing this -- to the
Western mind -- seemingly pointless project. But the American businessman,
sensing profit in the matter, ensures the Lama that their company can help.
Consequently, a powerful "ASC Mark V" computer and "electromatic typewriter" is
dispatched to the lamasery, along with 2 technicians to make sure things go
right. They calculate that the job will be finished in only 3 months’ time.
(The lamasery had previously installed a diesel generator with sufficient
power to run the computer. It was originally intended as a power source to
turn their prayer wheels – a visionary Lama indeed!)
In Clarke’s story, we only know that the names of God are limited to 9
characters in length. What we don’t know are what the "special characters"
are, or how many of them exist in the "special alphabet" alluded to by the
Lama. We know from the story title that the total number of permutations is on the
order of 9 billion. There is also a caveat in the story: the programming of
the computer can eliminate any "ridiculous combinations" of characters,
defined by the Lama as more than 3 of the same characters in a row.
Not being a good statistician, I don’t really know how to figure the total
number of permutations involved in this problem. But being a decent
programmer, I can devise code that will produce the total number of
permutations involved. Here is an example of VBtm
BASIC code that can handle the Lama’s task:
Public Sub
Form_Load()
Godnames.WindowState = 2
Godnames.Show
Call mainloop
End Sub
[Declarations]
Dim a$
Dim a1, a2, a3, a4, a5, a6, a7, a8, a9
Dim c(13)
Public Sub
mainloop()
'define which
particular ASCII characters are to be used (the "special alphabet").
' In this example,
the ASCIIs represent the characters
' A thru M (13
total characters in the set)
c(1) = 65
c(2) = 66
c(3) = 67
c(4) = 68
c(5) = 69
c(6) = 70
c(7) = 71
c(8) = 72
c(9) = 73
c(10) = 74
c(11) = 75
c(12) = 76
c(13) = 77
'Initialize the name string as 9
characters long
a$ = "xxxxxxxxx"
'start the
permutation loop, where every spot in the name string will get every
character,
' as each other
spot in turn does the same, in sequence.
' The variables a1
thru a9 represent each of the 9 positions in the name string.
For a1 = 1 To 13
Mid$(a$, 1, 1) = Chr$(c(a1))
For a2 = 1 To 13
Mid$(a$, 2, 1) = Chr$(c(a2))
For a3 = 1 To 13
Mid$(a$, 3, 1) = Chr$(c(a3))
For a4 = 1 To 13
Mid$(a$, 4, 1) = Chr$(c(a4))
For a5 = 1 To 13
Mid$(a$, 5, 1) = Chr$(c(a5))
For a6 = 1 To 13
Mid$(a$, 6, 1) = Chr$(c(a6))
For a7 = 1 To 13
Mid$(a$, 7, 1) = Chr$(c(a7))
For a8 = 1 To 13
Mid(a$, 8, 1) = Chr$(c(a8))
For a9 = 1 To 13
Mid$(a$, 9, 1) = Chr$(c(a9))
Text1.Text = a$
DoEvents
Next
Next
Next
Next
Next
Next
Next
Next
Next
End Sub
For this program, first establish a form named "Godnames" with a text box
in it. Copy the above text into the "form" procedure, the "declarations"
area, and a user-defined procedure named "mainloop", as appropriate.
Note that I've not taken advantage of the Lama's instruction to exclude any
names that have "more
than 3 of the same characters in a row". See the postscript below.
By my eyes, the total number of permutations figured in this nested routine is
N9, where N equals the number of characters in the "special
alphabet" being used. It is not stated in Clark’s story what size the alphabet
was. However, N=13 yields 1.06 X1010, whereas N=12 only yields 5.16
X109 – not quite 9 billion. So I must assume that, allowing for the
"cast-outs" in cases where more than 3 of the same characters appear in
sequence, the Lamas were using a 13-character alphabet. In the above example,
I simply used the first 13 characters of the English alphabet as the symbol
set. You can change these characters as you see fit, by changing the ASCII
numbers in the C( ) array definitions -- if you have a better notion as to
what characters comprise God’s names. (You might want to get some advice on this
from your local neighborhood Kabbalist.)
In the above program, I include the statement for showing the resultant
text string from each permutation in a screen text box. That introduces a
huge burden in the time to run the total program. For example, if you
don’t show the text display after every iteration, the time to run the entire
loop will be on the order of 160 minutes (based on a 1.8 GHz CPU and ME
operating system). If you think that it’s necessary (in God’s eyes) to
actually depict all His names on the screen, it will take on the order
of 27 days to complete. In Clarke’s original 1953 story, the estimated time
for the fictitious "ASC Mark V" computer system to print out hardcopies of all the names
was 100 days. That might not be too far off the mark, even using today’s
powerful PCs.
In the story, the monks would tear off the completed sheets coming from the
printer and paste them into "enormous books". Suppose you format the printout
as a 80-character wide by 60-line tall sheet, and have 8 columns of
9-character names on each sheet. That would equal 480 names on a sheet. It
would take 18,750,000 pages to handle the 9 billion names! And assuming 500
pages per "enormous book", that equates to 37,500 books of names!
The computer guys must have brought a lot of printer paper with them --
specifically, about 94 ea. 1-ton pallets' worth; the amount of paper gotten
from 2250 killed trees.
We can be slightly critical of Clarke's story's credibility at this point.
That's a lot of sheets to "paste into enormous books" within the time period
of 100 days. Figuring 18,750,000 sheets, that's 187,500 sheets pasted
per day = 7812 per hour = 130 per minute = a tad more than 2 per second.
Even figuring larger sheets with higher-density print fonts, it would be a
sight indeed to see those hustling, sweaty monks, frantically racing from the
printer to their pasting tables and back again!
I haven’t run this program to completion, as I’m a little afraid of the
consequences. Toward the end of Clark’s tale, we learn the reason for the
monks’ centuries-long efforts. They believe that Mankind’s sole purpose is to
define these 9 billion names of God. Once complete, God will finally be
satisfied with his creation, and will then proceed to end it. In the story, as the computer
Technicians look up into the Tibetan sky at the end of the computer run, they
are horrified to see the stars winking out, one by one…
Back to
Recreational Computing...
Photo of the Potala monastery Copyright©2000-2004 DarrellPeck.com
If you're a purist, you can put a screening test in the
program to check for more than 3 characters in a row, before printing the name
string. (It will add a lot of time overhead into the program.)
Slip these lines in immediately above the "text1.text=a$" line, revise the
text printing line, and move the "DoEvents" command as shown:
mt=0
'assume there are not more than 3
characters in a row
For i=3
to len(a$)
'look through the string, starting at the 3rd
character
If mid$(a$,i,1)=mid$(a$,i-1,1) then
'if the last one is the same character
If mid$(a$,i,1)=mid$(a$,i-2,1) then
'and if the one before that is also the same
mt=1
'change the assumption flag
i=len(a$) 'stop
looking through the string
End If
End If
Next
If mt=0
Then text1.text=a$: DoEvents
'only print name string if it passes the test
If you don't include
this routine, it's possible that God could get perturbed by calling him lots
of stupid names. It might even border on blasphemy if you decide not to
screen those bad names out...