Average Error: 21.5 → 0.1
Time: 42.6s
Precision: 64
Internal Precision: 1344
\[\left(n \cdot \log \left(1 + \frac{1}{n}\right) + \log \left(n + 1\right)\right) - 1\]
\[\begin{array}{l} \mathbf{if}\;\left(\log \left(1 + n\right) + n \cdot \log \left(1 + \frac{1}{n}\right)\right) - 1 \le 4.107518220584942:\\ \;\;\;\;\left(\left(\sqrt[3]{\log \left(1 + n\right)} \cdot \sqrt[3]{\log \left(1 + n\right)}\right) \cdot \sqrt[3]{\log \left(1 + n\right)} + \left(n \cdot \log \left(\sqrt[3]{1 + \frac{1}{n}}\right) + \left(n + n\right) \cdot \log \left(\sqrt[3]{1 + \frac{1}{n}}\right)\right)\right) - 1\\ \mathbf{else}:\\ \;\;\;\;\log n + \left(\frac{\frac{1}{2}}{n} - \frac{\frac{1}{6}}{n \cdot n}\right)\\ \end{array}\]

Error

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (- (+ (* n (log (+ 1 (/ 1 n)))) (log (+ n 1))) 1) < 4.107518220584942

    1. Initial program 0.0

      \[\left(n \cdot \log \left(1 + \frac{1}{n}\right) + \log \left(n + 1\right)\right) - 1\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.0

      \[\leadsto \left(n \cdot \log \color{blue}{\left(\left(\sqrt[3]{1 + \frac{1}{n}} \cdot \sqrt[3]{1 + \frac{1}{n}}\right) \cdot \sqrt[3]{1 + \frac{1}{n}}\right)} + \log \left(n + 1\right)\right) - 1\]
    4. Applied log-prod0.0

      \[\leadsto \left(n \cdot \color{blue}{\left(\log \left(\sqrt[3]{1 + \frac{1}{n}} \cdot \sqrt[3]{1 + \frac{1}{n}}\right) + \log \left(\sqrt[3]{1 + \frac{1}{n}}\right)\right)} + \log \left(n + 1\right)\right) - 1\]
    5. Applied distribute-lft-in0.0

      \[\leadsto \left(\color{blue}{\left(n \cdot \log \left(\sqrt[3]{1 + \frac{1}{n}} \cdot \sqrt[3]{1 + \frac{1}{n}}\right) + n \cdot \log \left(\sqrt[3]{1 + \frac{1}{n}}\right)\right)} + \log \left(n + 1\right)\right) - 1\]
    6. Applied simplify0.0

      \[\leadsto \left(\left(\color{blue}{\log \left(\sqrt[3]{1 + \frac{1}{n}}\right) \cdot \left(n + n\right)} + n \cdot \log \left(\sqrt[3]{1 + \frac{1}{n}}\right)\right) + \log \left(n + 1\right)\right) - 1\]
    7. Using strategy rm
    8. Applied add-cube-cbrt0.1

      \[\leadsto \left(\left(\log \left(\sqrt[3]{1 + \frac{1}{n}}\right) \cdot \left(n + n\right) + n \cdot \log \left(\sqrt[3]{1 + \frac{1}{n}}\right)\right) + \color{blue}{\left(\sqrt[3]{\log \left(n + 1\right)} \cdot \sqrt[3]{\log \left(n + 1\right)}\right) \cdot \sqrt[3]{\log \left(n + 1\right)}}\right) - 1\]

    if 4.107518220584942 < (- (+ (* n (log (+ 1 (/ 1 n)))) (log (+ n 1))) 1)

    1. Initial program 43.3

      \[\left(n \cdot \log \left(1 + \frac{1}{n}\right) + \log \left(n + 1\right)\right) - 1\]
    2. Taylor expanded around inf 0.2

      \[\leadsto \color{blue}{\left(\left(\frac{1}{2} \cdot \frac{1}{n} + 1\right) - \left(\log \left(\frac{1}{n}\right) + \frac{1}{6} \cdot \frac{1}{{n}^{2}}\right)\right)} - 1\]
    3. Applied simplify0.2

      \[\leadsto \color{blue}{\left(\left(\frac{\frac{1}{2}}{n} + 0\right) - \frac{\frac{1}{6}}{n \cdot n}\right) + \log n}\]
  3. Recombined 2 regimes into one program.
  4. Applied simplify0.1

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\left(\log \left(1 + n\right) + n \cdot \log \left(1 + \frac{1}{n}\right)\right) - 1 \le 4.107518220584942:\\ \;\;\;\;\left(\left(\sqrt[3]{\log \left(1 + n\right)} \cdot \sqrt[3]{\log \left(1 + n\right)}\right) \cdot \sqrt[3]{\log \left(1 + n\right)} + \left(n \cdot \log \left(\sqrt[3]{1 + \frac{1}{n}}\right) + \left(n + n\right) \cdot \log \left(\sqrt[3]{1 + \frac{1}{n}}\right)\right)\right) - 1\\ \mathbf{else}:\\ \;\;\;\;\log n + \left(\frac{\frac{1}{2}}{n} - \frac{\frac{1}{6}}{n \cdot n}\right)\\ \end{array}}\]

Runtime

Time bar (total: 42.6s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (n)
  :name "n*log(1+1/n)+log(n+1)-1"
  (- (+ (* n (log (+ 1 (/ 1 n)))) (log (+ n 1))) 1))