|
|||
Run a FRACTRAN ProgramOne of the most brilliant mathematicians of all time, J. H. Conway at Princeton University, discovered a “Simple Universal Programming Language for Arithmetic”, which he named FRACTRAN. The idea is deceptively simple but unexpectedly powerful and is based on the next fraction game. There is given a finite list of fractions f1, f2, …, fk and a starting integer n. “You repeatedly multiply the integer you have at any stage (initially n) by the earliest fi in the list for which the product is integral. Whenever there is no such fit, the game stops.” (Quotation from T. M. Cover et al. (eds.), Open Problems in Communication and Computation, Springer-Verlag New York Inc., 1987) Thats all. Here it is the program, i.e. the “game”, which lists… all the prime numbers! 17⁄91, 78⁄85, 19⁄51, 23⁄38, 29⁄33, 77⁄29, 95⁄23, 77⁄19, 1⁄17, 11⁄13, 13⁄11, 15⁄2, 1⁄7, 55⁄1 More exactly, if you start with n = 22, then whenever a power of two appears as the value of n, then that is exactly the subsequent prime power of 2: 23, 25, 27, 211, 213, 217, … Question: How many steps does it take starting with n = 22 to obtain n = 237? Input SpecificationThere is no input for this problem. Output SpecificationThe output should contain a single integer, the number of steps required. |
|||
University of Debrecen; Faculty of Informatics; v. 03/01/2019 |