This article needs additional citations for verification .(July 2019) |
Four fours is a mathematical puzzle, the goal of which is to find the simplest mathematical expression for every whole number from 0 to some maximum, using only common mathematical symbols and the digit four. No other digit is allowed. Most versions of the puzzle require that each expression have exactly four fours, but some variations require that each expression have some minimum number of fours. The puzzle requires skill and mathematical reasoning.
The first printed occurrence of the specific problem of four fours is in Knowledge: An Illustrated Magazine of Science in 1881. [1] A similar problem involving arranging four identical digits to equal a certain amount was given in Thomas Dilworth's popular 1734 textbook The Schoolmaster's Assistant, Being a Compendium of Arithmetic Both Practical and Theoretical . [2]
W. W. Rouse Ball described it in the 6th edition (1914) of his Mathematical Recreations and Essays. In this book it is described as a "traditional recreation". [3]
There are many variations of four fours; their primary difference is which mathematical symbols are allowed. Essentially all variations at least allow addition ("+"), subtraction ("−"), multiplication ("×"), division ("÷"), and parentheses, as well as concatenation (e.g., "44" is allowed). Most also allow the factorial ("!"), exponentiation (e.g. "444"), the decimal point (".") and the square root ("√") operation. Other operations allowed by some variations include the reciprocal function ("1/x"), subfactorial ("!" before the number: !4 equals 9), overline (an infinitely repeated digit), an arbitrary root, the square function ("sqr"), the cube function ("cube"), the cube root, the gamma function (Γ(), where Γ(x) = (x− 1)!), and percent ("%"). Therefore:
etc.
A common use of the overline in this problem is for this value:
Typically, the successor function is not allowed since any integer above 4 is trivially reachable with it. Similarly, "log" operators are usually not allowed as they allow a general method to produce any non-negative integer. This works by noticing three things:
Writing repeated square root in this form we can isolate n, which is the number of square roots:
We can isolate both exponents by using the base 4 logarithm:
This logarithm can be thought of as the answer to the question: "4 to what power gives me 4 to the half power to the n power?"
so we are now left with:
and now we can take a logarithm to isolate the exponent, n:
so, putting it all together:
Now, we can rewrite the base (1/2) with only 4s and the exponent (1/2) back to a square root:
We have used four fours and now the number of square roots we add equals whatever non-negative integer we wanted.
Paul Bourke credits Ben Rudiak-Gould with a different description of how four fours can be solved using natural logarithms (ln(n)) to represent any positive integer n as:
Additional variants (usually no longer called "four fours") replace the set of digits ("4, 4, 4, 4") with some other set of digits, say of the birthyear of someone. For example, a variant using "1975" would require each expression to use one 1, one 9, one 7, and one 5.
Here is a set of four fours solutions for the numbers 0 through 32, using typical rules. Some alternate solutions are listed here, although there are actually many more correct solutions. The entries in blue are those that use four integers 4 (rather than four digits 4) and the basic arithmetic operations. Numbers without blue entries have no solution under these constraints. Additionally, solutions that repeat operators are marked in italics.
0 =4 ÷ 4 × 4 − 4= 44 − 44 1 =4 ÷ 4 + 4 − 4= 44 ÷ 44 2 =4 −(4 + 4)÷ 4= (44 + 4)÷ 4! 3 =(4 × 4 − 4)÷ 4=(4 + 4 + 4)÷ 4 4 =4 + 4 ×(4 − 4)= −44 + 4!+ 4! 5 =(4 × 4 + 4)÷ 4= (44 − 4!)÷ 4 6 =(4 + 4)÷ 4 + 4= 4.4 + 4 ×.4 7 =4 + 4 − 4 ÷ 4= 44 ÷ 4 − 4 8 =4 ÷ 4 × 4 + 4= 4.4 −.4 + 4 9 =4 ÷ 4 + 4 + 4= 44 ÷ 4 −√4 10 = (4 + 4 + 4)−√4 = (44 − 4)÷ 4 11 = (4!×√4 − 4)÷ 4 = √4 ×(4!−√4)÷ 4 12 =4 ×(4 − 4 ÷ 4)= (44 + 4)÷ 4 13 = (4!×√4 + 4)÷ 4 = (4 −.4)÷.4 + 4 14 = 4 × 4 − 4 ÷√4 = 4 ×(√4 +√4)−√4 15 =4 × 4 − 4 ÷ 4= 44 ÷ 4 + 4 16 =4 × 4 + 4 − 4= (44 − 4)×.4 17 =4 × 4 + 4 ÷ 4= (44 + 4!)÷ 4 18 = 4 × 4 + 4 −√4 = (44 ÷√4) − 4 19 = 4!−(4 + 4 ÷ 4) = (4 + 4 −.4)÷.4 20 =4 ×(4 ÷ 4 + 4)= (44 − 4)÷√4 21 = 4!− 4 + 4 ÷ 4 = (44 −√4)÷√4 22 = 4!÷ 4 + 4 × 4 = 44 ÷(4 −√4) 23 = 4!+ 4 ÷ 4 −√4 = (44 +√4)÷√4 24 =4 × 4 + 4 + 4= (44 + 4)÷√4 25 = 4!− 4 ÷ 4 +√4 = (4 + 4 +√4)÷.4 26 = 4!+√4 + 4 - 4 27 = 4!+√4 +(4 ÷ 4) 28 =(4 + 4)× 4 − 4= 4!+ 4 + 4 - 4 29 = 4!+ 4 +(4 ÷ 4) 30 = 4!+ 4 + 4 -√4 31 = 4!+(4!+ 4)÷ 4 32 =4 × 4 + 4 × 4
Note that numbers with values less than one are not usually written with a leading zero. For example, "0.4" is usually written as ".4". This is because "0" is a digit, and in this puzzle only the digit "4" can be used.
There are also many other ways to find the answer for all of these. A given number will generally have a few possible solutions; any solution that meets the rules is acceptable. Some variations prefer the "fewest" number of operations or prefer some operations to others. Others simply prefer "interesting" solutions, i.e., a surprising way to reach the goal.
Certain numbers, such as 113, 157, and 347, are particularly difficult to solve under typical rules. For 113, Wheeler suggests . [4] A non-standard solution is , where 4' is the multiplicative inverse of 4. (i.e. ) Another possible solution is , where and represent the 14th and 127th multifactorials respectively and should technically be denoted with that many exclamation marks to adhere to the rules of the problem. Note that the number 113/16 can be written by three 4’s, but this does not help for 113 unless the square function (i.e. sq(4) = 16) is allowed.
The use of percent ("%") admits solutions for a much greater proportion of numbers; for example, 113 = (√4 + (√4 + 4!)%) ÷ (√4)%.
This problem and its generalizations (like the five fives and the six sixes problem, both shown below) may be solved by a simple algorithm. The basic ingredients are hash tables that map rationals to strings. In these tables, the keys are the numbers being represented by some admissible combination of operators and the chosen digit d, e.g. four, and the values are strings that contain the actual formula. There is one table for each number n of occurrences of d. For example, when d=4, the hash table for two occurrences of d would contain the key-value pair 8 and 4+4, and the one for three occurrences, the key-value pair 2 and (4+4)/4 (strings shown in bold).
The task is then reduced to recursively computing these hash tables for increasing n, starting from n=1 and continuing up to e.g. n=4. The tables for n=1 and n=2 are special, because they contain primitive entries that are not the combination of other, smaller formulas, and hence they must be initialized properly, like so (for n=1)
T[4] := "4"; T[4/10] := ".4"; T[4/9] := ".4...";
and
T[44] := "44";.
(for n=2). Now there are two ways in which new entries may arise, either as a combination of existing ones through a binary operator, or by applying the factorial or square root operators (which does not use additional instances of d). The first case is treated by iterating over all pairs of subexpressions that use a total of n instances of d. For example, when n=4, we would check pairs (a,b) with a containing one instance of d and b three, and with a containing two instances of d and b two as well. We would then enter a+b, a-b, b-a, a*b, a/b, b/a) into the hash table, including parenthesis, for n=4. Here the sets A and B that contain a and b are calculated recursively, with n=1 and n=2 being the base case. Memoization is used to ensure that every hash table is only computed once.
The second case (factorials and roots) is treated with the help of an auxiliary function, which is invoked every time a value v is recorded. This function computes nested factorials and roots of v up to some maximum depth, restricted to rationals.
The last phase of the algorithm consists in iterating over the keys of the table for the desired value of n and extracting and sorting those keys that are integers. This algorithm was used to calculate the five fives and six sixes examples shown below. The more compact formula (in the sense of number of characters in the corresponding value) was chosen every time a key occurred more than once.
This and the next section come from (http://groups.google.com/group/es.ciencia.matematicas/browse_thread/thread/fe6327c55ca865df/e9e694e07265091b#e9e694e07265091b Riedel, Marko.)
139 = (5+5/5)!/5-5 140 = .5*(5+5*55) 141 = 5!+(5+5.5)/.5 142 = 5!+55/5/.5 143 = ((5+5/5)!-5)/5 144 = ((55/5)-5)!/5 145 = 5*(5+5*5)-5 146 = 5!+(5/5)+(5*5)) 147 = 5!+.5*55-.5 148 = 5!+.5*55+.5 149 = 5+(((5+(5/5)))!+5)
In the table below, the notation .6... represents the value 6/9 or 2/3 (recurring decimal 6).
241 = ((.6+((6+6)*(6+6)))/.6) 242 = ((6*(6+(6*6)))-(6/.6)) 243 = (6+((6*(.6*66))-.6)) 244 = (.6...*(6+(6*(66-6)))) 245 = ((((6)!+((6)!+66))/6)-6) 246 = (66+(6*((6*6)-6))) 247 = (66+((6+((6)!/.6...))/6)) 248 = (6*(6+(6*(6-(.6.../6))))) 249 = (.6+(6*(6+((6*6)-.6)))) 250 = (((6*(6*6))-66)/.6) 251 = ((6*(6+(6*6)))-(6/6))
The number e is a mathematical constant approximately equal to 2.71828 that is the base of the natural logarithm and exponential function. It is sometimes called Euler's number, after the Swiss mathematician Leonhard Euler, though this can invite confusion with Euler numbers, or with Euler's constant, a different constant typically denoted . Alternatively, e can be called Napier's constant after John Napier. The Swiss mathematician Jacob Bernoulli discovered the constant while studying compound interest.
In mathematics, the factorial of a non-negative integer , denoted by , is the product of all positive integers less than or equal to . The factorial of also equals the product of with the next smaller factorial: For example, The value of 0! is 1, according to the convention for an empty product.
In mathematics, the geometric mean is a mean or average which indicates a central tendency of a finite collection of positive real numbers by using the product of their values. The geometric mean of numbers is the nth root of their product, i.e., for a collection of numbers a1, a2, ..., an, the geometric mean is defined as
In mathematics, the logarithm to baseb is the inverse function of exponentiation with base b. That means that the logarithm of a number x to the base b is the exponent to which b must be raised to produce x. For example, since 1000 = 103, the logarithm base of 1000 is 3, or log10 (1000) = 3. The logarithm of x to base b is denoted as logb (x), or without parentheses, logb x. When the base is clear from the context or is irrelevant it is sometimes written log x.
The natural logarithm of a number is its logarithm to the base of the mathematical constant e, which is an irrational and transcendental number approximately equal to 2.718281828459. The natural logarithm of x is generally written as ln x, logex, or sometimes, if the base e is implicit, simply log x. Parentheses are sometimes added for clarity, giving ln(x), loge(x), or log(x). This is done particularly when the argument to the logarithm is not a single symbol, so as to prevent ambiguity.
In mathematics, a square root of a number x is a number y such that ; in other words, a number y whose square is x. For example, 4 and −4 are square roots of 16 because .
The imaginary unit or unit imaginary number is a solution to the quadratic equation x2 + 1 = 0. Although there is no real number with this property, i can be used to extend the real numbers to what are called complex numbers, using addition and multiplication. A simple example of the use of i in a complex number is 2 + 3i.
In mathematics, exponentiation is an operation involving two numbers: the base and the exponent or power. Exponentiation is written as bn, where b is the base and n is the power; often said as "b to the power n". When n is a positive integer, exponentiation corresponds to repeated multiplication of the base: that is, bn is the product of multiplying n bases: In particular, .
In mathematics, Stirling's approximation is an asymptotic approximation for factorials. It is a good approximation, leading to accurate results even for small values of . It is named after James Stirling, though a related but less precise result was first stated by Abraham de Moivre.
In mathematics, an nth root of a number x is a number r which, when raised to the power of the positive integer n, yields x:
In mathematics, a quadratic irrational number is an irrational number that is the solution to some quadratic equation with rational coefficients which is irreducible over the rational numbers. Since fractions in the coefficients of a quadratic equation can be cleared by multiplying both sides by their least common denominator, a quadratic irrational is an irrational root of some quadratic equation with integer coefficients. The quadratic irrational numbers, a subset of the complex numbers, are algebraic numbers of degree 2, and can therefore be expressed as
In mathematics, specifically complex analysis, the principal values of a multivalued function are the values along one chosen branch of that function, so that it is single-valued. A simple case arises in taking the square root of a positive real number. For example, 4 has two square roots: 2 and −2; of these the positive root, 2, is considered the principal root and is denoted as
In mathematics, tetration is an operation based on iterated, or repeated, exponentiation. There is no standard notation for tetration, though Knuth's up arrow notation and the left-exponent xb are common.
In number theory, the integer square root (isqrt) of a non-negative integer n is the non-negative integer m which is the greatest integer less than or equal to the square root of n,
Methods of computing square roots are algorithms for approximating the non-negative square root of a positive real number . Since all square roots of natural numbers, other than of perfect squares, are irrational, square roots can usually only be computed to some finite precision: these methods typically construct a series of increasingly accurate approximations.
In mathematics, the inverse hyperbolic functions are inverses of the hyperbolic functions, analogous to the inverse circular functions. There are six in common use: inverse hyperbolic sine, inverse hyperbolic cosine, inverse hyperbolic tangent, inverse hyperbolic cosecant, inverse hyperbolic secant, and inverse hyperbolic cotangent. They are commonly denoted by the symbols for the hyperbolic functions, prefixed with arc- or ar-.
In applied mathematics, a transcendental equation is an equation over the real numbers that is not algebraic, that is, if at least one of its sides describes a transcendental function. Examples include:
Fast inverse square root, sometimes referred to as Fast InvSqrt or by the hexadecimal constant 0x5F3759DF, is an algorithm that estimates , the reciprocal of the square root of a 32-bit floating-point number in IEEE 754 floating-point format. The algorithm is best known for its implementation in 1999 in Quake III Arena, a first-person shooter video game heavily based on 3D graphics. With subsequent hardware advancements, especially the x86 SSE instruction rsqrtss
, this algorithm is not generally the best choice for modern computers, though it remains an interesting historical example.
In mathematics, the natural logarithm of 2 is the unique real number argument such that the exponential function equals two. It appears regularly in various formulas and is also given by the alternating harmonic series. The decimal value of the natural logarithm of 2 truncated at 30 decimal places is given by:
The square root of 6 is the positive real number that, when multiplied by itself, gives the natural number 6. It is more precisely called the principal square root of 6, to distinguish it from the negative number with the same property. This number appears in numerous geometric and number-theoretic contexts. It can be denoted in surd form as and in exponent form as .
...It contains the following puzzle. 'Says Jack to his brother Harry, "I can place four threes in such manner that they shall make just 34; can you do so too?"'