Fractran machine!

Bernhard Herzog herzog at online.de
Fri May 19 08:13:23 EDT 2000


Boris Borcic <borcis at geneva-link.ch> writes:

> François Pinard wrote:
> > 
> > Hi, people.  Here is a Fractran machine, with a demo program. 
> 
> How long does the demo take to halt ?

I don't claim to have understood how the demo program for the fractran
machine works, but it seems pretty obvious that it will never halt.

>From the doc string:

   Each computation cycle works as follow. Find the first fraction for
   which the denominator exactly divides the accumulator. If there is no
   such fraction, the machine halts. ...

And the fractran program:

    fractran.load_program((17, 91),
                          (78, 85),
                          (19, 51),
                          (23, 38),
                          (29, 33),
                          (77, 29),
                          (95, 23),
                          (77, 19),
                          (1, 17),
                          (11, 13),
                          (13, 11),
                          (15, 14),
                          (15, 2),
                          (55, 1))

Note that the last item has a denominator of 1, so there will always be
a fraction whose denominator exactly divides the accumulator.

Another observation: If a program has a fraction whose denomintor is 1,
it must be the last one in the program. Fractions after that will never
be used.

-- 
Bernhard Herzog   | Sketch, a drawing program for Unix
herzog at online.de  | http://sketch.sourceforge.net/



More information about the Python-list mailing list