Using only $2$, $7$, and $7$ (each one must be used only once) and only using the operations $+$, $-$, $\times$, $\div$, $\textrm{^}$, and parentheses, make 8. You can also use decimals.
7 Answers
One possible answer is:
(7 / .7) - 2
-
$\begingroup$ Maybe someone can confirm with a proof/full explanation of some sort(or prove me wrong!) but I'm fairly confident this is the only solution (besides adding negatives to both numerator and denominator). $\endgroup$– TCooperSep 4, 2020 at 22:49
-
1
-
-
1$\begingroup$ @Nick Just for visual clarity. They weren't necessary, but I thought it might make it slightly faster to parse. $\endgroup$– Deusovi ♦Sep 5, 2020 at 13:20
-
$\begingroup$ Well: Any a / (a * n) where n != 0 results in 'n'. 7 / 0.7 = 7 / (0.7 * 10) = 10. 10 - 2 = 8. Although the zero-less decimal notation is quite controversial over here in Europe! $\endgroup$– BattleSep 5, 2020 at 18:02
Under a suitable interpretation of "you can also use decimals", another answer is
$7 + .\overline7 + .\overline2$, where the bars represent repeating decimals, so that the expression is $7 + 0.7777{\ldots} + 0.2222{\ldots}$.
-
$\begingroup$ Had this in mind, too, but that's a broad interpretation of "decimals". $\endgroup$ Sep 6, 2020 at 13:12
-
$\begingroup$ I would say the problem isn't the deimcals, it uses the digits more than once and/or uses a disallowed operator $\endgroup$– TCooperSep 8, 2020 at 17:25
-
1$\begingroup$ It's not so clear to me. Why is the decimal point an allowed operator? It's because of our interpretation of the imprecise "You can also use decimals". A repeating bar is a standard notation for repeating decimals, so that seems within a reasonable interpretation to me. $\endgroup$ Sep 8, 2020 at 20:12
Without allowing any tricks, especially not:
Zeroless decimals, like
.7
instead of0.7
Then here are all the solutions:
There are
no
solutions.
Justification:
import itertools
import operator
d1 = lambda x,y: 10*x + y
d2 = lambda x,y: x + y/10
d3 = lambda x,y: x + y/100
for f,g in itertools.permutations([operator.add, operator.sub, operator.mul, operator.truediv, operator.floordiv, operator.pow, d1,d2,d3, operator.xor]*2, 2):
for x,y,z in itertools.permutations([2,7,7]):
try:
if (g(f(x,y), z) == 8):
print('({} {} {}) {} {}'.format(x,f,y,g,z))
except (ZeroDivisionError, TypeError):
pass
try:
if (g(x, f(y,z)) == 8):
print('{} {} ({} {} {})'.format(x,g,y,f,z))
except (ZeroDivisionError, TypeError):
pass
-
2$\begingroup$ This might be the most pedantic answer I've ever seen... but you aren't wrong lol $\endgroup$– TCooperSep 8, 2020 at 17:26
Interpreting the constraints as purely typographic:
$7^{(2)}/7$
($x^{(n)}$ is commonly used to denote the rising factorial $x(x+1)...(x+n-1)$)
or (also rather mathsy):
$7+\left(\frac{2}{7}\right)$
($\left(\frac{n}{p}\right)$ is the Legendre symbol which for a prime $p$ and a natural number $n$ is defined as $0$ if $p$ divides $n$, as $1$ if $n$ is a "quadratic residue mod $p$", i.e. $n=a^2 \mod p$ for some non multiple $a$ of $p$, and as $-1$ if $n$ is a quadratic nonresidue mod $p$, i.e. no such $a$ exists; in our case $p=7,n=2$ we could choose $a$ to be either $3$ or $4$)
Unwieldy and arbitrary as this may look the concepts around the Legendre symbol are actually a pillar of elementary and not so elementary number theory.
or, bending the rules a tiny bit (there are many kinds of parentheses):
$\langle \{7,7+2\} \rangle$ or $\langle (7,7+2) \rangle$ or $\langle [7,7+2] \rangle$
(physicists use angular parentheses for averages)
I am not sure if this is mathematically valid but at least it works on my calculator:
$7^{(.)/2}+7$ where the lone decimal is interpreted as a zero
-
-
$\begingroup$ @LukasRotter not sure that's %100 clear from OP wording ("only once" is not "exactly once"). Besides, once you accept what the calculator accepts it is trivial to make the 2 go away. $\endgroup$ Sep 5, 2020 at 16:37
-
$\begingroup$ @LukasRotter As Paul Panzer said, its trivial to use the 2. In fact I edited it to use the 2 as well just in case that's what the OP meant $\endgroup$– nobodySep 5, 2020 at 16:40
Inspired by Deusovi's answer, here is another answer.
If we allow the
^
operator to be used refer to the XOR operator $\oplus$, we can write:
$(7 \div .7)\ ^\wedge\ 2$
This can be interpreted as such.
$(7 \div .7) \oplus 2$
-
3
-
5$\begingroup$ @HugoRune I use ^ as XOR operator, not exponent $\endgroup$– teedSep 5, 2020 at 5:30
-
3$\begingroup$ @HugoRune I suppose it's fair to call C/C++ (or Python for that matter) a rather common language. $\endgroup$ Sep 5, 2020 at 5:43
-
1$\begingroup$ Also, but perhaps that's just me, programming is about the only domain where leaving out the leading zero in a decimal fraction is borderline acceptable. $\endgroup$ Sep 5, 2020 at 5:51
-
$\begingroup$ Though ⊕ is much more common as a XOR operator, ^ is readily available in ASCII. I have never seen ⩒, ⩛, ↮, and ≢ used in the literature. Also, when in Programmer mode, the Windows built-in calculator uses ^ as XOR in the keyboard. $\endgroup$– teedSep 5, 2020 at 8:40
Does $\lceil7+2/7\rceil$ count where $\lceil . \rceil$ denotes the ceiling function, see https://en.wikipedia.org/wiki/Floor_and_ceiling_functions?
If that doesn't count what about $7+7^{[.2]}$ where $[.]$ is the rounding function to the next integer?
-
3$\begingroup$ Welcome to PSE! - Unfortunately, the question reads "and only using the operations +, -, *, /, ^, and parentheses, make 8." The ceiling function $\lceil x\rceil$ is not listed. $\endgroup$ Sep 5, 2020 at 17:26
-
$\begingroup$ Well, in a broad sense $\lceil$ and $\rceil$ look like parenthesis, don't they? ;) $\endgroup$ Sep 5, 2020 at 17:29
-
2$\begingroup$ I mean... they are listed under the "Brackets" section of en.wikipedia.org/wiki/List_of_mathematical_symbols#Brackets... didn't know that! :) $\endgroup$ Sep 5, 2020 at 17:31