1
$\begingroup$

There's a function that satisfies the following:

$f(2) = 1, f(2^2) = 2, f(-3^3) = 3$

$f^n(x) = 3(n-1) + f(x)$

Where $f^n$ means $f$ composed with itself $n$ times.

Lastly, $f$ is not equality preserving. That is, if $a = b$, then it is not necessary that $f(a) = f(b)$.

What is the definition of $f$, and what is the most inclusive domain it might have that satisfies the above?

$\endgroup$

2 Answers 2

6
$\begingroup$

$f(x)$ is a function that:

counts the length of the string $x$, or in other words, the number of separate symbols in the expression $x$.
The domain will be the set of all mathematical symbols (including numbers, decimal point, brackets, function symbol, operators, etc.)

Verification:

$2$ is one character, so $f(2) = 1$
$2^2$ is two characters, so $f(2^2) = 2$
$-3^3$ is three characters (negative sign, and the two $3$), so $f(-3^3) = 3$
And finally, for each application of $f$ beyond the first, it adds three characters $f, (, )$. For example $f^2(x) = f(f(x)) = f(f()) + f(x) = 3 + f(x)$, and by induction we get the property mentioned.

It's equality-breaking because $4 = 2^2$ but $1 = f(4) \neq f(2^2) = 2$

There is probably some more precision in the definition that I'm missing (to explain the last property), but I'm quite confident the general idea is in the right direction.

$\endgroup$
12
  • 3
    $\begingroup$ @user110391 If the domain are strings it is non standard to say the least to call them equal just because some interpretation of evaluation yields the same value. Similarly, how do you even define composition if the domain (strings) is disjoint from the image (numbers)? $\endgroup$ Nov 18 at 23:59
  • 1
    $\begingroup$ @Albert.Lang Who cares if its non-standard? It's a puzzle tagged with "lateral-thinking". As for your second question; the function doesn't care if its input is a number, it will treat it as the string it is represented as regardless. $\endgroup$
    – user110391
    Nov 19 at 15:23
  • 1
    $\begingroup$ Agree with OP here. The lateral thinking tag is what made me wrote this answer without much fuss about the exact details, haha. But to OP question, I still can't figure out what needs to be excluded 🤔 $\endgroup$
    – justhalf
    Nov 19 at 15:59
  • 1
    $\begingroup$ It's up to you to decide whether my answer has sufficiently captures the details of your puzzle, in which case you can just consider this case closed and finalize this answer with your final piece. For me, I don't think I will put more thoughts into this (other than incorporating your final piece, if given), so your question is more for other solvers :) $\endgroup$
    – justhalf
    Nov 23 at 2:52
  • 1
    $\begingroup$ @user110391 I think you’re misunderstanding Albert’s comment. It’s unclear what you mean by “If $a=b$, then it is not necessary that $f(a)=f(b)$”. What does equality mean in the domain? If the domain consists of strings then I would think $2^2 \neq 4$, but you seem to be implying that they are equal, which is certainly non-standard and should be mentioned in the question. Also, the definition of a “function” in mathematics requires the property you call “equality preserving”, so perhaps using the word “function” is misleading. $\endgroup$ Nov 25 at 9:21
4
$\begingroup$

As mentioned in juathalf's answer, the definition of the "function" $f$ is that

if $x$ is any appropriate string, expression, or arrangement of symbols, then $f(x)$ is the number of symbols in $x$, with duplicates included, but not including invisible "symbols" such as the exponentiation operator in $2^2$.

But what is the most inclusive possible domain of $f$? A first attempt at answering that is to simply say that the domain of $f$ is

the set of all arrangements of symbols (including the empty arrangement, so that $f()$ is defined as $0$).

However, the problem with this is that

it results in ambiguous expressions, since the expression $f(a) + f(b)$ could mean either the length of "$a$" plus the length of "$b$" or the length of "$a) + f(b$"!

One possible solution would be to say that

an ambiguous expression involving $f$ must be accompanied by an explanation of how it is interpreted.

A more hilarious option would be to say that

the parentheses around the argument of $f$ must be much larger than any potentially confusing parentheses inside the argument, so that the second interpretation above could be written as $f \bigg (a) + f (b \bigg)$.

But I think the author's intended domain is probably

the set of all arrangements of symbols that do not include unmatched parentheses.

$\endgroup$
4
  • $\begingroup$ Great stuff :), but there's still one additional subset that must disincluded. Furthermore, the set you disincluding is formulated too generally, meaning it is disincluding some valid inputs. $\endgroup$
    – user110391
    Nov 25 at 13:37
  • 1
    $\begingroup$ @user110391 the word you're looking for is "exclude" =p $\endgroup$
    – justhalf
    Nov 25 at 13:56
  • $\begingroup$ @justhalf Thank you, I was a bit annoyed at my lack of better words but I couldn't be bothered to find the right word xD $\endgroup$
    – user110391
    Nov 25 at 14:00
  • $\begingroup$ Our minds work in mysterious ways indeed. You already used that word in the comments under my answer, haha $\endgroup$
    – justhalf
    Nov 25 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.