Feynman’s Puzzle
June 12, 2009
Richard Feynman was an American physicist; he worked on the Manhattan Project that developed the atomic bomb, won the Nobel Prize in 1965 for his work in the development of quantum electrodynamics, and famously demonstrated the inelasticity of the rubber o-rings on the space shuttle Challenger using a clamp, a rubber band, and a glass of ice water. Feynman proposed this puzzle:
Your task is to solve Feynman’s Puzzle. When you are finished, you are welcome to read or run a suggested solution, or to post your solution or discuss the exercises in the comments below.
[…] Praxis – Feynman’s Puzzle By Remco Niemeijer Today’s Programming Praxis problem is about a long division puzzle by Richard Feynman. The provided […]
My Haskell solution (see http://bonsaicode.wordpress.com/2009/06/12/programming-praxis-feynman%E2%80%99s-puzzle/ for a version with comments):
digit :: Int -> Int -> Int
nth `digit` n = n `mod` 10 ^ nth `div` 10 ^ (nth – 1)
feinman :: [(Int, Int)]
feinman = [ (n1, n2)
| b <- [1..9], a <- [0..9], c <- [0..9], d <- [1..9], e <- [0..9], f <- [0..9], a /= b, a /= c, a /= d, a /= e, a /= f, e < d, let n1 = 100 * b + 10 * a + c, let n2 = 1000 * d + 100 * e + 10 * a + f, n1 * n2 > 999999, n1 * n2 < 10000000, digit 3 (n1 * n2) == a, digit 1 (d * n1) == a, digit 2 (d * n1) == a, digit 1 (e * n1) == a, digit 3 (a * n1) == a] main :: IO () main = print feinman [/sourcecode]
[…] The following is an interesting puzzle posted on the programming praxis website: Feynman’s Puzzle […]
[…] (Credits: I learnt of this problem from Thaddeus Abiy on brilliant.org. Image of Feynman’s notebook is from this site.) […]
The NASA people who knew about the elastic ring problem hinting to Feynman during dinner. He didn’t figure it out himself.