9 comments

  • hahajk10 hours ago
    i know everyone plays with their own rules, but from my perspective, a square root spends a 2 - it's not an operator like + or ! . there's an implicit "2" since you could also take the cube root or fourth root
    • jjmarr7 hours ago
      You can use `sin(arctan())` as the repeatable operator instead of sqrt(). Then &quot;unwrap&quot; by applying ^-2 - (2^-2)<p>3=(sin(arctan(sin(arctan(sin(arctan(2))))))^−2 − (2)^−2
      • schiffern52 minutes ago
        Perfect answer, I hate it :)
    • JumpCrisscross9 hours ago
      &gt; <i>it&#x27;s not an operator like + or !</i><p>Squaring is to multiplication as is the latter to addition. If roots are invalid then so should be multiplications.
      • penteract8 hours ago
        Exponentiation is to multiplication as multiplication is to addition. Squaring is to multiplication as doubling is to addition.
        • jolmg4 hours ago
          &gt; Squaring is to multiplication as doubling is to addition.<p>as halving is to addition.
          • penteract4 hours ago
            Square rooting is to multiplication as halving is to addition.
      • SamBam8 hours ago
        GP didn&#x27;t say roots are invalid, just that they burn a two.<p>If we agree that 2^2 uses two twos (and, indeed, that 2^3 isn&#x27;t valid, because it uses a 3), then what&#x27;s the equivalent of a square root?<p>Of course to my simple math brain, a square root is ^1&#x2F;2, which includes the digit 1. But I agree there is someone 2-ish about the square root.
        • direwolf205 hours ago
          It can be written as ²√2 and there&#x27;s also ³√2 and so on
          • schiffern43 minutes ago
            Yep.<p>It would be like if we had a stylistic convention that you can drop the second number in an addition and it becomes 1. So &quot;6 +&quot; means &quot;6 + 1.&quot;<p>Now I can trivially make any number, but I&#x27;m just &#x27;exploiting&#x27; a convenience feature in the notation:<p>0 = 2 + 2 - 2 - 2<p>1 = 2 + 2 - 2 - 2 +<p>2 = 2 + 2 - 2 - 2 + +<p>Etc
      • danparsonson9 hours ago
        Would you elaborate on that? That doesn&#x27;t make any sense to me
        • drfloyd518 hours ago
          Multiplication is repeated addition.<p>2x3= 2+2+2 AxB= A+A B times.<p>Raising to a power is repeated multiplication.<p>2^3= 2x2x2 A^B = AxA B times<p>Roots are the inverse of powers<p>Division is the inverse of multiplications.<p>Given this… the OC’s comment about giving exceptions to powers in the rules is nonsense because they are still operations.
          • mojomark8 hours ago
            Multiplication is <i>not</i> the same as repeated addition, which you can observe as soon as you try the two different operations on fractions or negative numbers. For example, you can&#x27;t add a number to itself 1&#x2F;3 times, but you can certainly scale a number by 1&#x2F;3.<p>Multiplication is a scaling operation.
            • reichstein59 minutes ago
              Multiplication is the generalization of repeated addition. Repeated addition can be generalized to fractional values.<p>In the integers, it is the same thing, with a rule for negative times.<p>In the rational numbers, you can generalize to adding a number to itself a rational number of times. Adding a&#x2F;b to itself p&#x2F;q times is defined as adding a to itself p times, with a divisor that is adding b to itself q times.<p>So adding the rational 5 (5&#x2F;1) with itself 2_and-1&#x2F;3 (4&#x2F;3) times just means (5+5+5+5) &#x2F; (1 + 1 + 1) = 20&#x2F;3, a rational that we can also write as 6 -and-2&#x2F;3. Only addition of integers is used.<p>Which is the same as rational multiplication (a&#x2F;b)<i>(p&#x2F;q) = (a</i>p)&#x2F;(b*q).<p>But it&#x27;s true that you can&#x27;t say that rational multiplication is the same as _integer_ repeated addition.
            • goodmythical6 hours ago
              Can you not? 9+(9<i>(1&#x2F;3)) [adding nine to itself a third of a time] is nine plus one third of nine {or nine divided by three} which is one of the three in three times three that equals nine which is three therefore 9+(9</i>(1&#x2F;3))=11 because 9+3=11
              • alpaca12856 minutes ago
                9+3=12, but otherwise I agree
        • jibalt7 hours ago
          Because it&#x27;s just wrong. hahajk said that taking the 2nd root spends a 2, not that &quot;roots are invalid&quot;. (FWIW, I&#x27;m not necessarily endorsing the view that the square root symbol implicitly spends a 2, I&#x27;m just saying that the counterarguments given are logically wrong ... actually more like <i>semantically</i> wrong.)<p>The comment below by drfloyd51 is similarly wrong ... hahajk didn&#x27;t say anything about &quot;giving exceptions to powers in the rules&quot;.<p>And the comment by speglt is also wrong:<p>&gt; If taking a square root is an inherent use of a two, then dividing a number by another number should also be a use of a two, because there are two operands.<p>The number of operands isn&#x27;t relevant; the degree of the root is.<p>And from SideQuark we get<p>&gt; One could even claim division is raising to the -1 power, thereby disqualifying it in exactly the same manner you disqualify sqrt.<p>But hahajk said nothing about anything being disqualified. (Not to mention that division is not raising to the -1 power ... raising what? n&#x2F;d = n * d^-1, but this is completely irrelevant to hahajk&#x27;s argument.)
        • spieglt8 hours ago
          Multiplication is adding numbers to themselves. Exponentiation is multiplying numbers by themselves. Ditto division&#x2F;taking roots. Squaring a number is just the instance of exponentiation that happens to have two operands. If taking a square root is an inherent use of a two, then dividing a number by another number should also be a use of a two, because there are two operands.
    • ta2345fa59be2 hours ago
      Or use the successor operator.
    • SideQuark9 hours ago
      Alternatively, one can claim sqrt is a single symbol, and there are extensions requiring a digit. Log, ln, also have hidden bases, but they’re also valid symbols. Cos&#x2F;sin may be in radians or degrees, both in common use, and no real place to denote it.<p>One could even claim division is raising to the -1 power, thereby disqualifying it in exactly the same manner you disqualify sqrt. I’ve never seen sqrt with a 2 index; power -1 is seen quite often for division.<p>Go figure….
  • adas069311 hours ago
    there is a related problem (inspired by an interview questions from ITA software, a part of Google now) that asks to find the smallest positive integer that cannot be expressed using a digit K (in [2,9]) N times in an expression that involves the four basic arithmetic operations and the parentheses: +, -, *, &#x2F;, (, and ).<p>to make the problem more interesting, the list of operations can be extended to include exponentiation and concatenation.<p>for example, using the four basic operations for N=4, and K in [2,9], we get:<p>7 cannot be computed in 4 2s; 11 cannot be computed in 4 3s; 10 cannot be computed in 4 4s; 8 cannot be computed in 4 5s; 9 cannot be computed in 4 6s; 4 cannot be computed in 4 7s; 5 cannot be computed in 4 8s; 4 cannot be computed in 4 9s;
    • catlifeonmars10 hours ago
      This feels very suspiciously like a finite field problem.
    • genter11 hours ago
      Are you allowed to brute force it?
      • argee10 hours ago
        That&#x27;s how you do it right? It&#x27;s a BFS with 4 being the max depth, and you print whatever numbers in the problem set which you didn&#x27;t find.
      • dooglius6 hours ago
        Figuring that out is presumably part of the interview (and would depend on N)
  • bajard3 hours ago
    22 is cheating because 22 = 2*10+2 is arbitrary in base 10. If you write 22 in some base, you have to write the base, and that&#x27;s an extra number.
  • gnabgib12 hours ago
    Popular last year (368 points, 165 comments) <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43145753">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43145753</a>
  • allywilson3 hours ago
    I&#x27;ll just drop this here (yes, it&#x27;s 4 instead of 2 - they&#x27;re twice as good): <a href="https:&#x2F;&#x2F;fourmula.awsum.info&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fourmula.awsum.info&#x2F;</a>
  • Arnt12 hours ago
    Spoilsport.<p>And JFYI since December is near: <a href="https:&#x2F;&#x2F;rant.gulbrandsen.priv.no&#x2F;hack&#x2F;advent-calendar-for-nerds" rel="nofollow">https:&#x2F;&#x2F;rant.gulbrandsen.priv.no&#x2F;hack&#x2F;advent-calendar-for-ne...</a>
  • teo_zero12 hours ago
    Never understood why 7 is considered difficult...<p>7 = ⌈ 2.2² + 2 ⌉
    • blueblock11 hours ago
      Rounding spoils the fun of the puzzle.
      • nostrademons10 hours ago
        It seems very much in the spirit of allowing concatenation and square roots...
      • jtari33333 hours ago
        Rounding is a completely valid mathematical operation.
    • anthk8 hours ago
      (2 &lt;&lt; 2) - ( 2 &#x2F; 2)
    • AnimalMuppet11 hours ago
      It is difficult when the rules do not allow exponentiation.
      • Jtsummers11 hours ago
        <p><pre><code> 7 = ⌈ 2.2 + 2 + 2⌉ </code></pre> Would still work.
  • shoo3 hours ago
    There&#x27;s a direct trivial solution for any natural number using the successor function S(a) = a + 1 from Peano arithmetic.<p>Encode 0 as 2 + 2 - 2 - 2 then apply S a times to that 0.<p>Only depends upon natural numbers &amp; Peano stuff, no need for construction of rationals, irrationals, logarithms, etc.