Clues, Riddles, and Guesses for Treasure 167


Alfvaen wrote (July 12, 1997):

/dev/joe sent me a Python program(which I hope he will provide a copy of for the web pages if Malenkai so wishes)accompanied by documentation which rigorously determine the possible ranges for the pangram's letter counts, and then runs through them all. Since the program terminated without producing any output, it appears that an "Ackanomic-inspired pangram" does not exist, and by providing a proof(by exhaustion...:-), /dev/joe has satisfied the conditions of the map.

Hopefully some other form of Ackanomic-inspired pangram does exist, and I will devote a few spare CPU cycles to the search. If so, the BWG will publish it someday.


breadbox wrote (July 12, 1997):

Here's an actual pangram, though it's not particularly satisfying:

 This Ackanomics-inspired spangram contains seven a's, one b, four c's,
 three d's, thirty-six e's, six f's, two g's, eleven h's, fifteen i's,
 one j, two k's, two l's, three m's, twenty-one n's, thirteen o's,
 three p's, one q, thirteen r's, thirty-three s's, twenty-five t's,
 two u's, seven v's, seven w's, three x's, five y's, and one z.
Note that the first line contains two more s's than the original challenge. (I found this pangram just before I found that I had a bug in my program involving s's....)


/dev/joe provided the proof:

#!/usr/bin/python
#
# This is a proof of the non-existence of the Ackanomic-inspired pangram.
# It comes in the form of a python program.  I will prove that if this
# program produces no answer, there is none.
#
# Chapter I: Limiting the maximum amount of each letter
#
# One of the "coefficients" of the letters is the largest one.
# How large can this be?  The limit is how large a number can fit
# in the formula such that numbers equal to or less than it can fill
# the formula and make that many of one letter.
#
# Numbers of a thousand or more would require an average of about
# 38 occurrences of a particular letter per number-word, and our numbers
# simply aren't that long -- for example, seventy three thousand three
# hundred seventy three has just 11 e's, and ninety nine thousand nine
# hundred ninety nine has 12 n's, and this is the most under 100,000.
#
# The ones that are that have that many of a single letter are many orders
# of magnitude larger, and those larger numbers require numbers larger than
# are defined in standard english in order to get enough occurrences of
# letters, which seems to be outside the bounds of the problem.  So at
# the most our numbers are in the hundreds.
#
# No numbers over 198 could appear, by the same reasoning -- this requires
# an average of 10 occurrences in each of the 17 number words which can
# still vary, but none of the sub-1000 number words has more than 7 of a
# single letter -- three hundred seventy three is one such example.
#
# The possible number words that could appear in the sentence are:

aword=['','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']
tword=['','','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety']
hword='hundred'

# Note that zero cannot appear because each letter already appears once
# in the base string (it *is* supposed to be a pangram, after all).
#
# The absolutely constant part of the sentence is:

base='thisackanomicinspiredpangramcontainsabcdefghijklmnopqrstuvwxyandz'

# There are also quite a few extra s's (one per letter that appears more
# than once, for forming plurals of the letters.)
#
# This fixes the numbers of a's, b's c's, j's, k's, m's, p's, q's, and z's
# at 7, 1, 4, 1, 2, 3, 3, 1, and 1, as they appear in none of the number
# words.  Also, d only appears in 'hundred' and three additional times.
#
# The letters in the "base" string above, plus the fixed numbers above,
# plus an s for each letter except b, j, q, and z, gives this initial
# distribution of letters:
#
# A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
# 7  1  4  3 12  2  2  4  6  1  2  1  3 12  9  3  1  6 27  6  2  2  2  1  1  1
#
# Now, what is the maximum number of times each letter can occur?  As a first
# limit, count the number of times each letter appears in the base string
# above, plus an s for each letter except those known to occur only once
# (since we don't pluralize letters which appear just once), plus the
# fixed 'seven', 'one', 'four', etc. for the nine known letters, and
# count the maximum number of times each letter could appear in a
# number in the range of 1 to 198, for each of the 17 unknown numbers.
#
#  Letter  Fixed   Max in  Which Number
#          Occur.  Number  (smallest example)
#     d      3        2        100
#     e     12        6        117
#     f      2        3         54
#     g      2        2         88
#     h      4        3        133
#     i      6        2         35
#     l      1        1         11
#     n     12        5        119
#     o      9        3        141
#     r      6        3        133
#     s     27        2         66
#     t      6        3         22
#     u      2        2        104
#     v      2        2         75
#     w      2        2         22
#     x      1        2         66
#     y      1        1         20
#
# Also note that only 3 of these numbers could possibly be ones, so 24 of
# the 27 'fixed' s's are guaranteed to occur.  All the other "fixed" values
# are minimums.
#
# Now, in the worst case where there are 3 o's in every number, there could
# only be at most 9 + 17*3 = 60 o's or 27 + 17*2 = 61 s's.  All the other
# letters besides n and e have lower max limits.  There are at most
# 12 + 17*5 = 97 n's.  So only e could possibly appear more than 100 times.
# But in sub-100 numbers, e occurs at most 4 times (17, 73, 77), so now
# we know that there are at most 12 + 6 (for e) + 16*4 (for other letters)
# = 82 e's.  So no hundreds can occur.  In numbers 97 or below, n occurs
# at most 3 times (19, etc.) so the max n's is now 12 + 16*3 = 60, but sixty
# doesn't have 3 n's so the limit is 59.  Also, the limit on o's and s's
# was reduced below 60 since the 'three' for d did not have any; only e can
# occur as many as 60 times.
#
# Now we revise our chart, to allow numbers only up to 82, and consider
# some second-best cases as well (shown after a slash).  Since we have
# proven there cannot be hundreds, treat d as a constant now (and update
# the fixed amounts of t, h, r, and e).
#
#  Letter  Fixed   Max in  Which Number
#          Occur.  Number  (smallest)
#     e     14        4         17
#     f      2        3/2/1     54/44/4
#     g      2        1          8
#     h      5        2/1       33/3
#     i      6        2/1       35/5
#     l      1        1         11
#     n     12        3         19
#     o      9        2/1       41/1
#     r      7        2/1       33/3
#     s     27        2/1       66/6
#     t      7        3/2       22/13
#     u      2        1          4
#     v      2        2/1       75/5
#     w      2        2/1       22/2
#     x      1        2/1       66/6
#     y      1        1         20
#
# Now, the maximum number of e's is 14 + 16*4 = 78.
# Calculate maximum numbers of each letter, assuming each unknown number
# can be anything up to 59 except e is up to 78.  The max n's would be 60
# by these methods but that maximum would require sixty to contain 3 n's,
# which it doesn't, so use a max of 59:
#
#  Letter  Fixed   Max in  Which Number  Max
#          Occur.  Number  (smallest)   Occur.
#     e     14        4         17       78
#     f      2        3/2/1     54/44/4  50
#     g      2        1          8       18
#     h      5        2/1       33/3     37
#     i      6        2/1       35/5     38
#     l      1        1         11       17
#     n     12        3         19       59
#     o      9        2/1       41/1     41
#     r      7        2/1       33/3     39
#     s     27        2/1       66/6     44
#     t      7        3/2       22/13    55
#     u      2        1          4       18
#     v      2        2/1       75/5     19
#     w      2        2/1       22/2     34
#     x      1        2/1       66/6     18
#     y      1        1         20       17
#
# This gives us new limits.  6 numbers cannot be over 19, so the max t's is
# reduced to 49, the max h's to 31, the max i's to 32, the max o's to 35,
# the max r's to 33, the max w's to 28, and the max y's to 11.
#
# Only e, f, n, s, and t can occur 44 times, so the max f's is really only
# 2 + 3*3 + 2*2 + 11*1 = 26; now f can't occur 44 times either so the max
# f's is 24.
#
# Only e, n, o, s, and t can occur 41 times, so o can't actually occur 41
# times either, and the max o's is 9 + 4*2 + 12*1 = 29.
#
# The only numbers l occurs in at all are 11 and 12, so the numbers of e's
# and s's cannot contain an l so the max l's is 15.
#
#  Letter  Fixed   Max in  Which Number  Max
#          Occur.  Number  (smallest)   Occur.
#     e     14        4/3       17/11    14 + 16*4        = 78
#     f      2        3/2/1     54/44/4   2 + 3+3+ 2+2+ 12= 24
#     g      2        1          8        2 + 16*1        = 18
#     h      5        2/1       33/3      5 + 10*2 + 6*1  = 31
#     i      6        2/1       35/5      6 + 10*2 + 6*1  = 32
#     l      1        1         11        1 + 14*1        = 15
#     n     12        3/2       19/9     12 + 15*3 + 1*2  = 59
#     o      9        2/1       41/1      9 + 4*2  + 12*1 = 29
#     r      7        2/1       33/3      7 + 10*2 + 6*1  = 33
#     s     27        2/1       66/6     27 + 1*2  + 15*1 = 44
#     t      7        3/2       22/13     7 + 10*3 + 6*2  = 49
#     u      2        1          4        2 + 16*1        = 18
#     v      2        2/1       75/5      2 + 1*2  + 15*1 = 19
#     w      2        2/1       22/2      2 + 10*2 + 6*1  = 28
#     x      1        2/1       66/6      1 + 1*2  + 15*1 = 18
#     y      1        1         20        1 + 10*1        = 11
#
# Once again we can revise some of our estimates.
# In addition to the 6 numbers under 20, now h, i, o, f, and w occur
# at most 33 times, so the max r's is only 28 (27 after we account for
# r no longer being able to occur 33 times).  Now h, i, o, w, f, and r
# occur at most 32 times, so the max h's is 25, the max i's is 26.
#
# Now v cannot occur 19 times, because this requires 19 to contain a v, but
# it does not. So g, l, u, x, y and v cannot occur 19 times, so the max n's
# is reduced (but drop the earlier assumption that not all the numbers could
# have 3 n's because it would force the number of n's (60) to not have 3 n's;
# the analogy is no longer true, and this transition is why I have avoided
# making this assumption elsewhere).  The max n's is 54.
#
# Similarly l and y cannot occur 17 times, and s occurs between 23 and
# 43 times (no 4-e numbers), so the max e's is 75.
#
#  Letter  Fixed   Max in  Which Number  Max
#          Occur.  Number  (smallest)   Occur.
#     e     14        4/3       17/11    14 + 13*4 + 3*3  = 75
#     f      2        3/2/1     54/44/4   2 + 3+3+ 2+2+ 12= 24
#     g      2        1          8        2 + 16*1        = 18
#     h      5        2/1       33/3      5 + 4*2  + 12*1 = 25
#     i      6        2/1       35/5      6 + 4*2  + 12*1 = 26
#     l      1        1         11        1 + 14*1        = 15
#     n     12        3/2       19/9     12 + 10*3 + 6*2  = 54
#     o      9        2/1       41/1      9 + 4*2  + 12*1 = 29
#     r      7        2/1       33/3      7 + 4*2  + 12*1 = 27
#     s     27        2/1       66/6     27 + 1*2  + 15*1 = 44
#     t      7        3/2       22/13     7 + 10*3 + 6*2  = 49
#     u      2        1          4        2 + 16*1        = 18
#     v      2        2/1       75/5      2 + 1*2  + 14*1 = 19
#     w      2        2/1       22/2      2 + 10*2 + 6*1  = 28
#     x      1        2/1       66/6      1 + 1*2  + 15*1 = 18
#     y      1        1         20        1 + 10*1        = 11
#
# Save these 'fixed occurrences' for use later

cone,conf,cong,conh,coni,conl,conn,cono=14,2,2,5,6,1,12,9
conr,cons,cont,conu,conv,conw,conx,cony=7,27,7,2,2,2,1,1
a,b,c,d,j,k,m,p,q,z=7,1,4,3,1,2,3,3,1,1

# Chapter II: Grouping analysis
#
# This part of the proof takes a completely different approach than the
# first part.
#
# Out of the numbers involved in our proof, one through 75, all but the teens
# can be represented as a sum of lexical fragments -- for instance, all the
# 20's are 'twenty' plus the word for the number 1 through 9, or 'twenty'
# by itself for 20.  Some of the teens can be represented in the same
# system where the letter group for them is "teen", and most of the others
# just deviate by a letter or two -- so "ten" is an e short of the pattern;
# thirteen is 2 e's short (of "three" + "teen") and has an extra i.
# Eleven and twelve are real oddballs, so treat them as a separate group;
# by chance, we can treat this group as having "elve" added to the "one"
# or "two", and an o subtracted.  One is also an oddball, because it changes
# the sentence from "two x's" to "one x" -- dropping an s, but fortunately
# only a few coefficients can be ones.
#
# Now I define variables to represent the number of these unknown
# coefficients which contain each lexical fragment.
#
# The first set of variables represents the ones place; it divides the
# set of coefficients by their modulo 10 value.
# mod1 = the number of coefficients equal to 1 mod 10,
# mod2 = the no. of coeffs. equal to 2 mod 10, etc. up to mod9.
# The sum of mod0 + mod1 + mod2 + mod3 + ... + mod9 = 16.
#
# The second set of variables represents the tens place, mostly.
# g11s = the number of 11's and 12's
# gteens = the number of 10's and 13's through 19's
# g20s, g30s, g40s, g50s, g60s, g70s -- g20s is the number of 20's, etc.
# g0s (not used) represents the number of 1's through 9's.
# g0s + g11s + gteens + g20s + ... + g70s = 16
#
# Finally, the third set represent the odd cases.
# a1, a10, a13, a15, and a18 represent the numbers of 1's, 10's, 13's,
# 15's, and 18's.  Actually these variables appear differently in the
# program but we use these symbols here.
#
# You can write the total number of each letter as a combination of these
# groups.  For instance, x is mod6 + g60s + 1.  The 1 is the base value
# from the constant part of the sentence.  The other parts are due to x
# appearing in 'six' and 'sixty'.
#
# Here are all the lexical elements we use, in summary:
#
# mod1 mod2 mod3  mod4 mod5 mod6 mod7  mod8  mod9
# one  two  three four five six  seven eight nine
#
# g11s   gteens g20s   g30s   g40s   g50s   g60s   g70s
# elve-o teen   twenty thirty forty  fifty  sixty  seventy
#
# a1  a10  a13   a15   a18
# -s  -e   i-ee  f-ve  -t
#
# Here are these equations for all the letters:
#
# e = 14 + mod1 + 2*mod3 + mod5 + 2*mod7 + mod8 + mod9 + 2*gteens + 2*g11s +
#     g20s + 2*g70s - a10 - 2*a13 - a15
# f = 2 + mod4 + mod5 + g40s + 2*g50s + a15
# g = 2 + mod8
# h = 5 + mod3 + mod8 + g30s
# i = 6 + mod5 + mod6 + mod8 + mod9 + g30s + g50s + g60s + a13
# l = 1 + g11s
# n = 12 + mod1 + mod7 + 2*mod9 + gteens + g20s + g70s
# o = 9 + mod1 + mod2 + mod4 + g40s - g11s
# r = 7 + mod3 + mod4 + g30s + g40s
# s = 27 + mod6 + mod7 + g60s + g70s - a1
# t = 7 + mod2 + mod3 + mod8 + gteens + 2*g20s + 2*g30s + g40s + g50s +
#     g60s + g70s - a18
# u = 2 + mod4
# v = 2 + mod5 + mod7 + g11s + g70s - a15
# w = 2 + mod2 + g20s
# x = 1 + mod6 + g60s
# y = 1 + g20s + g30s + g40s + g50s + g60s + g70s
#
# Here, store the maxima for the g groups.
mg11s=14    #e, s not possible (min 14,24)
mgteens=15  #s not possible (min 24)
mg20s=10    #g,l,u,v,x,y (max < 20)
mg30s=4     #only e, n, s, t possible
mg40s=4     #only e, n, s, t possible
mg50s=2     #only e, n possible
mg60s=1     #only e possible
mg70s=1     #only e possible
#
# Chapter III: Checking all possible cases
#
# Now, in the "mainloop" below, I cycle through all the possible combinations
# of values of these variables.  However, there are checks at each level of
# iteration, wherever it might be possible to eliminate the current
# combination.  "remain" is the number of variables left to assign to 'mod'
# groups.  Information from chapter I on the possible numbers is used to
# restrict the search limits.  This program takes a while to run (about
# two days on a slow computer like my 486/66 I keep at home) and it finds
# no answer.


# These three 'num' functions are used to check a potential answer.
# numstring returns the word version of a number, plus the plural 's'
# when the number is not one.  numfull takes a list of the 26 numbers
# in the sentence and generates the whole sentence.  numcount counts up
# the letters in a string and returns a list of numbers suitable for
# sending to numfull.

def numstring(kk):
  rr=''
  if kk>1:
    rr='s'  #for the final s in "two z's"
  hunds=(kk-kk%100)/100
  if hunds>0:
    kk=kk%100
    rr=rr+aword[hunds]+hword
  tens=(kk-kk%10)/10
  if tens>1:
    kk=kk%10
    rr=rr+tword[tens]
  rr=rr+aword[kk]
  return rr

def numfull(nn):
  #nn should be a list of 26 numbers
  rr=base[:]
  for ii in nn:
    #generate number word text, add to string
    rr=rr+numstring(ii)
  return rr

def numcount(rr):
  xx=map(None,rr) #this converts string rr to a list
  zz=[]
  for letter in 'abcdefghijklmnopqrstuvwxyz':
    # for each letter, count the number of occurrences
    zz.append(xx.count(letter))
  return zz


# Some useful utility functions.  sum is exactly what it sounds like, the
# sum of a sequence of numbers.  isteen is a function passed to map,
# to count the teens in one part of the program.  ok takes three arguments,
# a list of numbers, a list of 'mod' variables (corresponding to the numbers
# in the first argument), and a list of letters whose values we have
# determined, and it determines if we have already assigned too many letters
# for a mod, as well as if we have too few letters left to meet a particular
# mod.  gok is a similar thing for the g variables, but it is only called
# at the end so it looks for equality.

def sum(nn):
  aa=0
  for ii in range(len(nn)):
    aa=aa+nn[ii]
  return aa

def isteen(aa):
  if (aa==10 or (aa>12 and aa<20)):
    return 1
  else:
    return 0

def ok(which,mods,vars):
  modc=[0]*10
  ok=1
  for ii in vars:
    # for each variable, increment the appropriate "mod" variable
    ww=ii%10
    modc[ww]=modc[ww]+1
  for jj in range(len(which)):
    # for each tested mod variable, nix the case if we already have too
    # many of that mod, or if we can't have enough even if all the remaining
    # coeffs are of that mod.  When vars contains all 16 variables, the
    # test reduces to mods != modc[which[jj]]
    if mods[jj]modc[which[jj]]+16-len(vars):
      ok=0
  return ok

def gok(g11s,gteens,g20s,g30s,g40s,g50s,g60s,g70s,vars):
  a11s,ateens,a20s,a30s,a40s,a50s,a60s,a70s=0,0,0,0,0,0,0,0
  for ii in vars:
    #for each var, increment the appropriate group, if any
    if ii==11 or ii==12:
       a11s=a11s+1
    elif ii==10 or (ii>=13 and ii<=19):
       ateens=ateens+1
    elif ii>=20 and ii<=29:
       a20s=a20s+1
    elif ii>=30 and ii<=39:
       a30s=a30s+1
    elif ii>=40 and ii<=49:
       a40s=a40s+1
    elif ii>=50 and ii<=59:
       a50s=a50s+1
    elif ii>=60 and ii<=69:
       a60s=a60s+1
    elif ii>=70 and ii<=79:
       a70s=a70s+1
  #we only call this when all g's are known so check all the g's always,
  #and only when all the vars are known so look for equality.
  if (a11s,ateens,a20s,a30s,a40s,a50s,a60s,a70s)==(g11s,gteens,g20s,g30s,g40s,g50s,g60s,g70s):
    aok=1
  else:
    aok=0
  return aok


# Here is the main loop.  Most of this is pretty self-explanatory
# given the definitions of the variables above.  We pick a variable,
# iterate over the full possible range of values, for each value,
# reset 'remain' for the next loop if it's a mod we just set, set
# any letters we have now determined, check that we haven't run
# into an impossibility, and if not then iterate the next variable.
#
# The unusual order of variables is used in order to determine letters
# as quickly as possible in order to eliminate cases.
#
# Remember our equations; the conX hold the constant terms.
#
# e = 14 + mod1 + 2*mod3 + mod5 + 2*mod7 + mod8 + mod9 + 2*gteens + 2*g11s +
#     g20s + 2*g70s - a10 - 2*a13 - a15
# f = 2 + mod4 + mod5 + g40s + 2*g50s + a15
# g = 2 + mod8
# h = 5 + mod3 + mod8 + g30s
# i = 6 + mod5 + mod6 + mod8 + mod9 + g30s + g50s + g60s + a13
# l = 1 + g11s
# n = 12 + mod1 + mod7 + 2*mod9 + gteens + g20s + g70s
# o = 9 + mod1 + mod2 + mod4 + g40s - g11s
# r = 7 + mod3 + mod4 + g30s + g40s
# s = 27 + mod6 + mod7 + g60s + g70s - a1
# t = 7 + mod2 + mod3 + mod8 + gteens + 2*g20s + 2*g30s + g40s + g50s +
#     g60s + g70s - a18
# u = 2 + mod4
# v = 2 + mod5 + mod7 + g11s + g70s - a15
# w = 2 + mod2 + g20s
# x = 1 + mod6 + g60s
# y = 1 + g20s + g30s + g40s + g50s + g60s + g70s

def mainloop():
  #
  #vary mod4 -- remember that range 0,17 goes over 0, 1, ..., 16
  #
  for mod4 in range(0,17):
   #
   #every time we set a mod, calculate "remain" for the next mod loop.
   #
   remain=16-mod4
   #
   # Hooray, we know enough to determine one variable!
   #
   u=conu+mod4
   #
   # Only if we haven't created an impossibility do we go onward.
   #
   if ok([4],[mod4],[u])==1:
    #vary mod6 -- remain is the max we can have for the given mod4
    for mod6 in range(0,remain+1):
     #recalculate remain
     remain=16-mod4-mod6
     #vary g60s (use maximum defined earlier)
     for g60s in range(0,mg60s+1):
      #another variable solved for
      x=conx+mod6+g60s
      #keep checking these things
      if ok([4,6],[mod4,mod6],[u,x])==1:
       #vary mod8
       for mod8 in range(0,remain+1):
        #print status report
        print 'Trying mod4=',mod4,'mod6=',mod6,'g60s=',g60s,'mod8=',mod8
        g=cong+mod8
        if ok([4,6,8],[mod4,mod6,mod8],[u,x,g])==1:
         #Call the function which contains the rest of our loop
         #This is split only because python has a limit on how many loops
         #and ifs can be nested in one function.
         #This was not split just to keep lines from being so long, though
         #that might have been a good reason. :-)
         retval=innerloop(mod4,mod6,g60s,mod8,u,x,g)
         if retval!=0:
           return retval
         #otherwise, keep going
  #if everything fails (closure of "for mod4" loop + all others)
  return 0
###
#end of "mainloop"

def innerloop(mod4,mod6,g60s,mod8,u,x,g):
 #pick up where we left off
 remain=16-mod4-mod6-mod8
 #vary mod3
 for mod3 in range(0,remain+1):
  remain=16-mod4-mod6-mod8-mod3
  #vary g30s (e is not possible if already used in 60's):
  for g30s in range(0,mg30s+1-g60s):
   #keep defining variables as is possible
   h=conh+mod3+mod8+g30s
   if ok([3,4,6,8],[mod3,mod4,mod6,mod8],[u,x,g,h])==1:
    #vary g40s (can't re-use the ones used in 30's or 60's)
    for g40s in range(0,mg40s+1-g30s-g60s):
     r=conr+mod3+mod4+g30s+g40s
     if ok([3,4,6,8],[mod3,mod4,mod6,mod8],[u,x,g,h,r])==1:
      #vary g70s (only e possible, not if used in 60's)
      for g70s in range(0,mg70s+1-g60s):
       #vary g50s (e not possible is used in 60's or 70's)
       for g50s in range(0,mg50s+1-g60s-g70s):
        #vary g20s (eliminate the ones used for higher vars)
        for g20s in range(0,mg20s+1-g30s-g40s-g60s):
         y=cony+g20s+g30s+g40s+g50s+g60s+g70s
         if ok([3,4,6,8],[mod3,mod4,mod6,mod8],[u,x,g,h,r,y])==1:
          #vary mod2
          for mod2 in range(0,remain+1):
           remain=16-mod4-mod6-mod8-mod3-mod2
           w=conw+mod2+g20s
           if ok([2,3,4,6,8],[mod2,mod3,mod4,mod6,mod8],[u,x,g,h,r,y,w])==1:
            #vary mod1
            for mod1 in range(0,remain+1):
             remain=16-mod4-mod6-mod8-mod3-mod2-mod1
             #calculate limits for g11s.
             #min is how many we have so far
             #max is either mod2+mod1 or min + the unassigned 7 vars
             # (besides e and s, which cannot be this low)
             min11s=[u,x,g,h,r,y,w].count(11)+[u,x,g,h,r,y,w].count(12)
             max11s=min([mod2+mod1,min11s+7])
             #vary g11s
             for g11s in range(min11s,max11s+1):
              l=conl+g11s
              o=cono+mod1+mod2+mod4+g40s-g11s
              if ok([1,2,3,4,6,8],[mod1,mod2,mod3,mod4,mod6,mod8],[u,x,g,h,r,y,w,l,o])==1:
               #vary mod7
               for mod7 in range(0,remain+1):
                remain=16-mod4-mod6-mod8-mod3-mod2-mod1-mod7
                #only l, x, y can possibly be 1, and these are known now
                s=cons+mod6+mod7+g60s+g70s-[l,x,y].count(1)
                if ok([1,2,3,4,6,7,8],[mod1,mod2,mod3,mod4,mod6,mod7,mod8],[u,x,g,h,r,y,w,l,o,s])==1:
                 #calculate limits for gteens
                 #min is how many we have so far
                 # [map applies the isteen function to each element and
                 # returns a list of the answers; sum adds the list;
                 # for 10 and 13-19, isteen == 1 ]
                 #max is either min + the unknown 6 vars or
                 #the number of vars not assigned to other g groups
                 minteens=sum(map(isteen,[u,x,g,h,r,y,w,l,o,s]))
                 maxteens=min([minteens+6,16-g20s-g30s-g40s-g50s-g60s-g70s-g11s])
                 #vary gteens between calculated limits
                 for gteens in range(minteens,maxteens+1):
                  #vary mod9
                  for mod9 in range(0,remain+1):
                   n=conn+mod1+mod7+2*mod9+g20s+gteens+g70s
                   remain=16-mod4-mod6-mod8-mod3-mod2-mod1-mod7-mod9
                   if ok([1,2,3,4,6,7,8,9],[mod1,mod2,mod3,mod4,mod6,mod7,mod8,mod9],[u,x,g,h,r,y,w,l,o,s,n])==1:
                    #vary mod5
                    for mod5 in range(0,remain+1):
                     if ok([1,2,3,4,5,6,7,8,9],[mod1,mod2,mod3,mod4,mod5,mod6,mod7,mod8,mod9],[u,x,g,h,r,y,w,l,o,s,n])==1:
                      #
                      # Here, we vary the last 4 variables, the a's,
                      # all at once.  min for each is how many we
                      # already have, and max is min + 5, but e
                      # cannot be 10 or 13, and we only have 5
                      # additional numbers (beyond the mins)
                      # over all 4 groups
                      #
                      min10s=[u,x,g,h,r,y,w,l,o,s,n].count(10)
                      min13s=[u,x,g,h,r,y,w,l,o,s,n].count(13)
                      min15s=[u,x,g,h,r,y,w,l,o,s,n].count(15)
                      min18s=[u,x,g,h,r,y,w,l,o,s,n].count(18)
                      ibase=coni+mod5+mod6+mod8+mod9+g30s+g60s+g50s+min13s
                      tbase=cont+mod2+mod3+mod8+gteens+2*g20s+2*g30s+g40s+g50s+g60s+g70s-min18s
                      vbase=conv+mod5+mod7+g11s+g70s-min15s
                      ebase=cone+mod1+2*mod3+mod5+2*mod7+mod8+mod9+2*gteens+2*g11s+g20s+2*g70s-min10s-2*min13s-min15s
                      fbase=conf+mod4+mod5+g40s+2*g50s+min15s
                      for x10s in range(0,5):
                       for x13s in range(0,5-x10s):
                        for x15s in range(0,6-x10s-x13s):
                         for x18s in range(0,6-x10s-x13s-x15s):
                          i,t,v,e,f=ibase+x13s,tbase-x18s,vbase-x15s,ebase-x10s-2*x13s-x15s,fbase+x15s
                          newitvef=[i,t,v,e,f]
                          if newitvef.count(10)==x10s and newitvef.count(13)==x13s and newitvef.count(15)==x15s and newitvef.count(18)==x18s:
                           # if we got here, this means the x's actually
                           # corresponded to the number of extra 10's, 13's
                           # 15;s and 18's we created in i, t, v, e, f
                           if ok([1,2,3,4,5,6,7,8,9],[mod1,mod2,mod3,mod4,mod5,mod6,mod7,mod8,mod9],[u,x,g,h,r,y,w,l,o,s,n,i,t,v,e,f])==1:
                            #we don't check the g's until way down here
                            #because most of them are determined by i,t,v,e,f
                            if gok(g11s,gteens,g20s,g30s,g40s,g50s,g60s,g70s,[u,x,g,h,r,y,w,l,o,s,n,i,t,v,e,f])==1:
                             #all clear -- everything checked out
                             #this check fails only if the program has bugs
                             #define the entire alphabet now
                             vals=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
                             nvals=numcount(numfull(vals))
                             if nvals==vals:
                              return vals
                             else:
                              print 'Unchecked condition!  Reached innermost check with:'
                              print 'vals='
                              print vals
                              print 'nvals='
                              print nvals
  ####################################
  # end of *that many* loops and ifs
  #
  # we get here only if the program failed to find an answer
  # in this innerloop segment
  return 0
####
# end of "innerloop"


#
# Here is the main program.  It just calls the mainloop and interprets the
# reponse, printing a pretty result if we find an answer.
#

vals=mainloop()
if vals==0:
  print 'Did not find an answer.'
else:
  print 'Answer:'
  print vals
  sent='This Ackanomic-inspired pangram contains '
  for ival in range(26):
    coef=numstring(ival)
    adds='abcdefghijklmnopqrstuvwxyz'[ival]
    if coef[0]=='s':
      coef=coef[1:]
    else:
      adds=adds+"'s"
    sent=sent+coef+' '+adds+', '
    if ival==24:
      sent=sent+'and '
  print sent
#numcount(numfull(vals))

Alfvaen wrote (July 26, 1997):

With the recent CFJ regarding inaccurate reporting of treasure map finding...it turns out that, due to a late-discovered flaw in /dev/joe's proof of the lack of existence of an Ackanomic-inspired pangram, he did not find the Exquisite Dead Guy.

Since he has now corrected the flaw, he has found the Exquisite Dead Guy. The map is the same as I posted before(obviously).

We apologize for any inconvenience.

Go Back