February 3rd, 2015, 4:01 pm
QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: Traden4AlphaYes, there certainly are solutions to this problem using +, and *. The funny part was the unstated requirement of doing it in integers and the notion that the problem poser had a very specific means-of-solution in mind and would not accept solutions that meant the original requirements.A secondary issue is that although the solution can be written in various programming languages with various degrees of terseness and elegance, the problem statement was written in English. Why can't we state problems in the same language that we state the solutions?Will programming languages always be second-class languages as long as one still needs English in order to define the problem?OP was probably obsessed/concerned with performance. Implicit requirement. Aka Requirements Elicitation, that's life.Mathematically, output is an integer, so sqrt(5) is an aberration.Anyways, the problem can be done with integers. Hmmmm... It's actually not clear if the float solution is slower than the integer solution given that the integer solution computes x^y twice.To me, the better brainteasers admit multiple solutions rather than one anointed answer.QuoteQuoteWill programming languages always be second-class languages as long as one still needs English in order to define the problem?In that sense, yes. But its' a wee bit navel-gazing.You may be right. Yet a more complete programming language would enable:1) Completeness! It seems funny to me that half of the overall process of programming must use a non-programming language.2) Minimizing the two-language problem (is ! a factorial or an exclamation point?)3) Writing algorithms that can naturally express the process of writing algorithms.