P461
projecteuler.net

Almost Pi

ℹ️Published on Saturday, 1st March 2014, 04:00 pm; Solved by 1350;
Difficulty rating: 30%

Let $f_n(k) = e^{k/n} - 1$, for all non-negative integers $k$.

Remarkably, $f_{200}(6)+f_{200}(75)+f_{200}(89)+f_{200}(226)=\underline{3.1415926}44529\cdots\approx\pi$.

In fact, it is the best approximation of $\pi$ of the form $f_n(a) + f_n(b) + f_n(c) + f_n(d)$ for $n=200$.

Let $g(n)=a^2 + b^2 + c^2 + d^2$ for $a, b, c, d$ that minimize the error: $|f_n(a) + f_n(b) + f_n(c) + f_n(d) - \pi|$
(where $|x|$ denotes the absolute value of $x$).

You are given $g(200)=6^2+75^2+89^2+226^2=64658$.

Find $g(10000)$.



Soluzione

Last modified: May 01, 2025. Website built with Franklin.jl and the lovely Julia programming language.