Cool, an Inform7 entry. :) I just had to give this one a try.
I'm pretty sure this is the intended solution:
R is a room.
To f (n - number): say "[n * n * real square root of n]".
Note that this solution only works if compiled with the Glulx back-end, due to the use of the
real square root of function.
BTW, the double quotes and square brackets are actually unnecessary; just
say n * n * real square root of n would work just as well. The periods at the end of the commands could be omitted, too; or we could keep the first period and get rid of the newlines instead. Other parts of the code we could trim away include the article "a" before "room" and the spaces before the parentheses and after the colon. Fortunately, since we've got a spare pair of brackets, we can always use them to comment out all these extra characters. ;) So this is a valid solution, too:
R is room.To f(n - number):say n * n * real square root of n[
" a . "
To test this solution interactively, it's convenient to append something like the following test harness to the code:
Effing is an action applying to one number.
Understand "f [number]" as effing.
Carry out effing: f the number understood.
After compiling and running the program, you can type e.g.
f 4. f 6. f 9. f 25 at the
> prompt and receive something like the following output:
An Interactive Fiction
Release 1 / Serial number 170404 / Inform 7 build 6L38 (I6/v6.33 lib 6/12N) SD
>f 4. f 6. f 9. f 25
BTW, I just noticed that Inform (or presumably, rather, Glulx) rounds the last decimal place of
f 6 wrong: the correct value is much closer to 88.18163 than to 88.18164. Fortunately, I don't think this affects the correctness of the solution(s), especially since the challenge specified "any rounding mechanism of your choice". :)