4

Given numbers 1,2,...n, the goal of this puzzle is to make a number as close to the mathematical constant $\ln(2) ≈ 0.69314718055$ as possible.


Rules

  • You can only use the four mathematical operations $+,-,\times,/$ and parentheses/brackets $()[]$.
  • It is not required to use all of the numbers.
  • You cannot concatenate (stick) the numbers together. (i.e. you can't get $12$ from $1,2$)

Examples:

$n$ Approximation Error
1 1 $3.068\cdot10^{-1}$
2 $\frac12=0.5$ $1.931\cdot10^{-1}$
3 $\frac23=0.\overline6$ $2.6481\cdot10^{-2}$
7 $\frac7{6+4+(1/(3\times2+5))}=\frac{77}{111}=0.\overline{693}$ $5.4651\cdot10^{-4}$
8 $\frac7{6+4+(2/(3\times8+1-5))}=\frac{70}{101}=0.\overline{6930}$ $7.7873\cdot10^{-5}$

Give your best approximation for n=1, 2, 3...20. (Give a possibly different answer for each n)


If anyone is curious I am currently only aware of optimal solutions for $n=1,2...8$.


Related
Related

msh210
  • 12,844
  • 2
  • 49
  • 120
CrSb0001
  • 2,231
  • 4
  • 29
  • 1
    Are we allowed to use decimal points? Like .5, .2, etc. Also can we put a minus sign (-) in front of a number to change its sign? – TLE on test 77 Mar 13 '24 at 05:32
  • 1
    Some discoveries for n = 9: [(78)+(91)-4]/[653-2] = 61/88 = 0.693(18) which gives an error of: 3.4637621872946056E-5

    [297+(5*1)]/[684-3] = 131/189 = 0.(693121) which gives an error of: 2.54874382521475E-5

    – Michael Moschella Mar 13 '24 at 06:51
  • 1
    A new one for n=9: (1248)/(56*9+7) = 192/277 = 0.(693140794223826714801444043321299638989169675090252707581227436823104) giving an error of 6.386336118602287E-6

    The only possible better solution now would be to achieve 253/365, which I am attempting now

    – Michael Moschella Mar 13 '24 at 07:18
  • Clarification: for any k in [1..n], each possible value of k can be used only once? – Jeff Zeitlin Mar 13 '24 at 10:35
  • @TLEontest77 No, decimal points have never been allowed in these math puzzles – CrSb0001 Mar 13 '24 at 12:16
  • @JeffZeitlin Yes, they can only be used once – CrSb0001 Mar 13 '24 at 12:17

1 Answers1

2

An approach (hinted at by @michaelmoschella in the comments) is to use the fraction approximation algorithm [insert citation].

Something like this: table

Here we start with 0/1, 1/1, and 1/0 ($=\infty$). Then we look which side our target number is in (left or right). Those numbers become the new boundaries, and the new middle numerator (denominator) is the sum of the new outer numerators (denominators).

I've highlighted the "best" rows, which tend to be the last best so far (so when it's the best so far, but the next row is not).

See here for the calcs.

So, for example, going after 445/642 is a reasonably fruitful exercise (7.63E-7).

$445 = (9\times10-1)\times5$

$642 = (11\times10-3)\times6$

Oh, but whoops, I've repeated the 10. But I could replace that we $(8+2)$.

So I get ($n=11$): $\frac{(9\times10-1)\times5}{(11\times(8+2)-3)\times6}$

I doubt it's the best, but it's a start.

Of course, the above is great for fractions, but we're here allowed to do more than that, so there may also be better approaches altogether.

You can also see $\frac{4+3}{2*5}$ for $n=5$ has an error of 6.85E-3.

Dr Xorile
  • 23,406
  • 3
  • 47
  • 125
  • You realize that it's only recommended to give a different answer for each n (e.g. n=3 can have the same sol. as n=4, as 2/3 is optimal for both) – CrSb0001 Mar 14 '24 at 12:45