lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Le jeu. 27 juin 2019 à 01:51, Gé Weijers <ge@weijers.org> a écrit :
It also does not solve the problem, Phillippe program would generate the square root of C.
Yes I know, and that what I wrote. But it's the basic idea, using a convergent loop. But this requires dividing by the derivate function of x => x^x, which requires the log function (which would then require some Taylor series for an approximation).
I wonder if the author of the problem just wants an approximation. You're right for the missing "end" keyword for the function. But my main comment was "what is the program", does it include the required header/trailer and the statement to print the result on a console (which almost completely eats the 36 bytes), or just the _expression_ that computes the result? He speaks about a preexisting "global" variable C, so there's an environment already loaded, and it conditions the way we can feed the computing _expression_ or we can output the result.
In just 36 bytes it's just impossible to write a complete program, but it may be possible to write a statement that computes the result within a function with a predefined name.