McCulloch's second machine
McCulloch's second machine
def mcculloch(digits):
Esoteric
tongue-in-cheek manner how some deceptively simple
wielder the powers of universal computation. Introduced by Raymond Smullyan in one of his clandestine brain teasers on logic and computability, McCulloch's second machine is a string
rewriting system that receives a string of digits between one and nine. The rewrite rule applied to the rest of the digits (denoted below by X) depends on the first digit. Notice how rule for the leading digit 2 is applied to X itself, whereas rules for the leading digits 3 to 5 are applied to
Y=mcculloch(X). This function should return None whenever X or Y is None.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps