5 ms·
I feel like the second you allow functions you've thrown the spirit of the game. Ex, the gamma function is (n-1)! So now you're making 7 with four twos and a o
by horsawlarway 2y ago
I feel like the second you allow functions you've thrown the spirit of the game.
Ex, the gamma function is (n-1)! So now you're making 7 with four twos and a one. You've broken the spirit.
If I can hide numbers in a function call... It's trivially easy to always succeed.
- lblume 2y agoI would argue that the Gamma function is more fundamental than the factorial operation. But you are still correct that if arbitrary functions were allowed, the game would degenerate to triviality.
- TOGoS 2y agoInorite. If we're allowing any old function, then I can just define 12345 as Onetwothreefourfive()-2+2-2+2
- Someone 2y ago> I feel like the second you allow functions you've thrown the spirit of the game. +, - (both binary and unary), ×, ÷ are functions, as is raising to a power. Why would you allow them? As always in this kind of things, one can disagree about what constitutes an elementary function, but I don’t think taking square roots should be disqualified in this puzzle. > Ex, the gamma function is (n-1)! And 2 is just S(S(0)) (https://en.wikipedia.org/wiki/Peano_axioms https://en.wikipedia.org/wiki/Peano_axioms) > If I can hide numbers in a function call... It's trivially easy to always succeed. I wouldn’t call the construction given by Paul Dirac trivial. Do you think it is, or do you know of a simpler one?
- dooglius 2y agoIt sounds like you've just found one for >=2: 2, S(2), S(S(2)), ...
- Someone 2y agoThat, somewhat ironically, typically isn’t included in the set of elementary functions. ‘plus’ is, but ‘plus one’ isn’t.
- tikhonj 2y agoThat gets at what makes using additional functions like in the blog post a bit arbitrary: we don't have special notation for "+ 1" or "* 2", but we do for "^(1/2)" and "log_2". It's not hard to imagine a different world where "+ 1" or "^2" had special notation, and suddenly we'd be able to solve the question in even simpler ways. It's still a fun puzzle, it's just based more on our shared notational conventions as much as the underlying math.
- madcaptenor 2y agoFor example it would not be weird to have ++ instead of +1.
- StilesCrisis 2y agoThat’s just S(n)
- thaumasiotes 2y ago> I wouldn’t call the construction given by Paul Dirac trivial. Do you think it is Yes? It's doing exactly the thing that your parent comment complains about in the gamma function, introducing additional constants (in this case, mostly 2s) that, for no particular reason, don't count. Why would you interpret squaring as consuming a 2, but square rooting as not consuming a 2?
- zeroonetwothree 2y agoBecause of our standard notation for those
- the__alchemist 2y agoYou are inferring that as a rule of the game by making assumptions. There are other conclusions different people could reach.
- karparov 2y agoAnd those other people are free to do whatever they like in their interpretation of the game.
- deleted 2y ago[deleted]
- omoikane 2y agoMaybe they meant symbolic operators feel alright but named functions feel like cheating, so 2+2+2+⌊√2⌋ is fine but 2+2+2+floor(sqrt(2)) is not.
- timerol 2y ago> And 2 is just S(S(0)) This is a good example of why you need rules on which functions are allowed. Repeated application of the successor function makes the entire exercise trivial
- Karellen 2y agoBut also, if the criteria for allowed functions is that they are "reasonable, elemental" (as per the fine article), then I think it would be quite hard to come up with a set of rules to encode that in a way that includes log() and sqrt(), but not S(). It's hard to imagine a function that is less elemental than S() (except maybe the identity function), or why its inclusion would be unreasonable when the other two aren't.
- saulpw 2y agoMy criteria are "no letters or digits from any language" (other than 2). So you can't use the log or S() or the gamma function, but you can use sqrt, because there is accepted symbology that does not require any atom of non-mathematical language to represent.
- pyrale 2y agoAPL programmers enter the room
- Karellen 2y agoWhat if it turns out that the radical (square root) symbol is a letter from a language (if a little squished)? And we somehow figure out one day which letter it is, for sure? https://en.wikipedia.org/wiki/Radical_symbol#Origin https://en.wikipedia.org/wiki/Radical_symbol#Origin
- jesterswilde 2y agoGiven how the article is laid out, I think it would be more appropriate to view the game from the lens of when we teach the operations in school, as opposed to what are fundamental or elementary operations / functions in math. Though I also think square root is cheating, it has an implicit 2 inside of it, where as raising to the power of 2 and log 2 are explicit. You could also argue for only infix operators. A good game must be somewhat challenging or else it is not really a game. Anything that makes the game trivial ought be omitted for it to be a game.
- the__alchemist 2y agoThat's exactly the point. What exactly, is the set of allowable functions used for the problem? I think you, and the post you reply to, are stating the same thing. Where do you draw a line between "Functions available on a 4-function calculator" and "Functions I can make up specifically to generate a target integer"? I think you have to rigidly define this, or the game loses meaning.
- deleted 2y ago[deleted]
- jrockway 2y agoRight, I invented the jrockway function which is defined as f(2, 2, 2, 2) = 7 so I made 7. Maybe the rule is "someone else has to invent the function", but I invented that so you can use it. (Please make me a the__alchemist function.) Maybe the rule should be that the function has to be invented before the inventor has knowledge of this game. But now I'm just going through /usr/bin looking for binaries where the 2222th byte is 0x7.
- karparov 2y agoLet karparov(2222) be defined as the number of whole seconds that have elapsed since this message was posted. You cover all naturals this way! But you're all missing the point. A winning "solution" to this game is whatever the reader accepts as a legal solution which at the same time is as creative as possible. That's necessarily subjective, but that's fine. Anybody is free to argue that it's a stupid game if these are the rules, and those folks just don't need to play and can let everybody else have some fun!
- jrockway 2y agoPerfect! Over time I will eventually win this game!
- jonahx 2y agoThis is a great point. I think what you're really responding to is that it's a game without clear rules, and so part of the "game" is thinking about creative interpretations of the rules themselves and pushing the boundary of what others originally assumed the rules to be. Granted there is creativity in this sort of game -- indeed, most "games" in life are like this -- but it's quite a different thing from winning a game with clearly defined rules like chess, or this game with the set of allowed operations specified up front.
- ajkjk 2y agoyou shouldn't be able to use letters. You're supposed to use four 2s and symbols, not four 2s plus the letters "l", "o", "g".
- necovek 2y agoBut letters are symbols too. (Mostly goes to show that it's really hard to be precise and allow some mathematical language and disallow some)
- RajBhai 2y agoI would say that any function that implicitly favors a single number must be explicitly stated, and thus, if used for this game, be the number 2. So all uses of the radical must state which root (2). Dirac's solution then wouldn't work because the use of 2 is O(n). Logs would also need to state the base. No implicit use of e or 10, and lg wouldn't be allowed in place of log2. I haven't said much other than logs and roots are binary operators with one of the operands usually implicit in the notation, so if we don't have special notation for powers and exponentiation, then we shouldn't allow the same for their inverse operations.
- necovek 2y agoWhy not? Why is it ok to use "22" = 2 * 10^1 + 2 (when it could be a number in base 3 — 2 * 3^1 + 2 = 8 decimal — or any other base)? This implies base 10, just like root implies base 2, or ln means e. As I said, this is a game, and trying to imply certain artificial constraints will be really hard with how abstract maths is. Again, mention of successor function is apt: everything else is built from 1, succ() and another axiom, definition or so. So everything else can be reduced to this.
- RajBhai 2y agoI said that this implicit use of 10 or some other number shouldn't be allowed. So log, ln, lg (i.e base 2) shouldn't be allowed, but log_b(x) where b and x are states is OK, just as 10^x, e^x, and 2^x require you to explicitly expose the base (and for this puzzle, disallow 10 and e since neither is a 2). Successor is essentially s(n) = n + 1, so that shouldn't be allowed either.
- quietbritishjim 2y agoI think a key distinction is that those are functions of two parameters. You can't just use them as many times as you like "for free" like the square root trick at the end of the article, because you need to "spend" at least one extra 2 on the second parameter each time. That's not the whole story of course, you still need to agree on the set of allowed operations, but I think it makes a big difference even though it seems incidental at first.
- nwallin 2y agoSurely we accept unary minus as one of our functions? Once we accept one unary function we're just quibbling over details. I agree that you need to define and agree upon a finite set of allowed operations before playing the game. IMHO, square root, logarithm/exp, floor/round/ceiling, sin/cos/tan ought to be included in the list. But that's just like, my opinion, man.
- billyjmc 2y agoBut repeated application of the unary minus basically results in a no-op. So it’s somewhat exceptional in that regard.
- Boldened15 2y agoIt’s just about having fun at the end of the day, the gamma function and square root are considered fundamental enough. But if one wants they could try to limit to different subsets of functions and prove which numbers are possible or impossible to achieve just with those. They also say “mathematical tools” not arbitrary functions.
- vlovich123 2y agoThe Dirac solution doesn’t involve gamma, just N square roots and 2 logarithms.
- Biganon 2y agoBut the square root has a hidden operand, 2. We don't write it because by convention the default root is 2, but that still feel like cheating to me.
- necovek 2y agoThis is why people have brought up the successor function too: A + B, is, by definition B applications of Succ() on A: A + B = Succ(Succ(Succ(...Succ(A)))) So using your own argument, we could say that using '+' is simply a convention on how we can write down the above — if we insist on spelling "conventional" things out, we must be able to use the underlying elementary function[]. Or isn't a factorial n! really n(n-1)...21, so all those numbers spelled out? The mathematical root probably first appeared as a square root and was later extended to support other exponents. But is there any fun in this? As noted elsewhere, the game is in finding the rules, and a solution within those rules. []Since all the natural numbers other than 1 are defined using a Succ() functions, there's a trivial solution. But if we only limit ourselves to this most elementary operation, we can't get a 1 because that's an axiom in itself ("There exists 1" or "There is a set of cardinality 1").
- orthoxerox 2y agoI think the correct definition of A + B is A + 0 = A (or A + 1 = Succ(A), if you insist 0∉ℕ) A + Succ(B) = Succ(A) + B
- necovek 2y agoNot sure what you mean with "correct", because "correct" is an equivalence class of slightly different definitions? Eg. https://en.wikipedia.org/wiki/Peano_axioms https://en.wikipedia.org/wiki/Peano_axioms has, instead of both yours and mine: A + 0 = A A + Succ(B) = Succ(A + B) They would all be proven in the same manner, though some might be slightly stronger in relation to commutation, making some proofs easier off the bat.
- codegladiator 2y ago> If I can hide numbers in a function call Yeah this feels like those "Implemented XYZ in 1 line" import XYZ
- thfuran 2y agoThat's just what it evaluates to on integers. The standard definition of it also includes e and an integral from 0 to ∞.
- vesinisa 2y agoI think you have a point, but as others have commented "allowing functions" is not the problem, as fundamental math operations are functions. But if we limit ourselves to only functions that map (tuples of) integers to integers ((Z, Z, ...) -> Z), the spirit of the original game is retained. This disallows sqrt and log, but retains addition, subtraction and multiplication (but not division). Factorial (n!) is allowed, as is exponentiation to a non-negative power. Wonder if someone could come up with general solution within these constraints.
- amluto 2y agoI think that, if you are restricted to a finite list of n-ary functions, n>=2, each returning a single value, then you can’t do it, as you will only have finitely many valid expressions. This may be easier to see in a stack machine / RPN model. An expression is a list of operations, drawn from a finite set, each of is either “push the number 2” or something that decreases the stack size by at least 1. And you need exactly 4 pushes. So a valid expression has four pushes and at most 3 other operations, because otherwise the stack would underflow. This gives a finite number of possible expressions, but there are an infinite number of integers, so it can’t work.
- throwway120385 2y agoAre you sure the number of possible expressions is finite? Or is it countably infinite? I could in theory make an arbitrarily long expression out of the four fundamental operators, and because I can derive -1 from a finite set of operations it is possible to derive any integer from any even integer. You can also derive zero from the rules.
- lmm 2y ago> I could in theory make an arbitrarily long expression out of the four fundamental operators Not with only four inputs you can't. You can only have three operations, because you have no way of getting another input parameter.
- vesinisa 2y ago
- the__alchemist 2y agoThis was my initial thought once we got to the Gamma function. My reasoning is (I'm pretty sure it's the same as yours), why is the gamma function allowed, but not others? I could insert arbitrary functions to make the game arbitrarily solvable. While this hit me at the Gamma introduction, I think it leads back to the beginning: It's a poorly defined problem from the rules at the start of the article. It should instead define the set of allowable functions (or operations) explicitly. I think you could modify this to retain the intent of showing how the problem scales with knowledge level.
- shmerl 2y agoSince in essence you can define your own functions f that give you any number you want from 2 (and for example not defined anywhere else). I.e. rules never said you can't use any function. They are vaguely saying "any mathematical operation".
- PhillyPhuture 2y agoThere's a version of this with "4"s that I have done through 20. I have used factorials and square roots but nothing more. I felt dirty. BUT I did not use "44", which I did see in some solutions. That seemed out of bounds to me!
- unbalancedevh 2y ago> You've broken the spirit. Maybe. But I doubt many people are aware of such functions, so it's still a fun challenge.
- bell-cot 2y ago> I feel like...you've thrown the spirit of the game. It's a little "brain teaser" game, to encourage kids to practice fairly basic math. Don't take it too far out of context.
- z3t4 2y ago7 = Math.ceil(Math.random(2))+2*2+2
- MisterKent 2y agoYou don't even need gamma for 7: 2 + 2 + 2 + floor(sqrt(2)) Which feels at least more in the spirit of the challenge than gamma.
- account42 2y agoThe article already has a solution for 7 (and any other number) that doesn't use the gamma function.