lua-users home
lua-l archive

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


I can do 41 bytes.

x=3 while 1 do x=math.log(C,x)print(x)end

Op Do. 27 Jun. 2019 om 23:39 het Egor Skriptunoff
<egor.skriptunoff@gmail.com> geskryf:
>
> On Wed, Jun 26, 2019 at 11:47 PM Egor Skriptunoff wrote:
>>
>> Global variable "C" contains numeric value > 15.5
>> The solution of math equation x^x=C must be printed
>> Your code must fit into 36 bytes
>> Dirty tricks are allowed
>
>
>
> Some sort of codegold-related cheating is required to solve this task, so I should tell more about "dirty tricks".
>
> Dirty trick #1:
>    Please note that the task doesn't require that your program should exit after the job is done.
>    The program might exit, but it doesn't have to.
>
> What should we do if a program never stops?
> Just wait until you runs out of patience and then kill the process.
> My own patience lasts for 3 seconds :-)
>
> Dirty trick #2:
>    The task says that "the solution must be printed".
>    But it wasn't required that your program should print only one number.
>
> What should we do if a program prints a lot of text?
> Just ignore the "invisible" text scrolled up beyond the screen.
>
> These tricks are unfair, but they save several bytes of code.
> With these tricks allowed, you can write a program which simply prints infinite sequence of numbers converging to the correct answer.
> First lines of output would contain incorrect values, but later the old values would be scrolled up and replaced with more correct approximations.
> At the moment when the program is killed, the whole screen would contain the correct answer on every line.
>
>
> My program prints some sequence of numbers converging to the root of equation x^x=C.
> Your task is either to write similar program which runs endlessly
> or to print the root calculated using some other approach.
>
> Now, with the "dirty tricks" explained, the task become quite solvable.
>