Can this program be shortened? Measuring program-length?

r.e.s. r_e_s_01 at
Thu Jul 10 21:57:51 CEST 2008

Can the following program be shortened? ...

def h(n,m):
 while (E!=())*m>0:n=h(n+1,m-1);E=E[:-1]+(E[-1]>0)*(E[-1]-1,)*n
 return n

Note:  Although it halts eventually in principle, this program can't be
expected to terminate on any machine in the universe, as it computes a 
number larger than Graham's number -- assuming Python is extended (if
necessary?) to access unbounded storage.

Besides using one-letter names and no unneeded whitespace, can something
more be done to shorten it?  ("Obfuscating" the code would be okay.) 

Also, I'm not really sure how best to measure a program's length, but 
this one is now 98 bytes long (or 102 bytes, depending on how newlines 
are handled).  Is there a better measure of program-length?

Thanks for any feedback.

More information about the Python-list mailing list