Funny.
I felt uncomfortable about using such complex math as Lagrange Interpolating Polynomial while not remembering how it actually worked.
I set out to invent a simpler switching function, which would select one value out of 11 based on an integer variable N and then convert that value into an integer of my choice. And I have invented such formula!
Thereafter, I consulted a respectable mathematical reference website and discovered that my simple and beautiful switching function was the Lagrange Interpolating Polynomial! Now I understand how it works! It appears 18th century mathematicians (Waring and Euler) invented it just for this puzzle.
I shall give a better explanation the puzzle solution and Lagrange Polynomial. It could be useful to some math students and, perhaps, parents of high school students who are about to get bogged down in those dreaded AP math classes.
Lagrange Polynomial: http://mathworld.wol...Polynomial.html
Edited by Prime, 29 January 2013 - 10:43 PM.







