Created
February 20, 2018 12:57
-
-
Save LuxXx/b6ddc7d122e19b0795294398a46cda4c to your computer and use it in GitHub Desktop.
weirdest euler approximation based on https://twitter.com/AnalysisFact/status/961338838084878337
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WeirdEuler { | |
public static int N = 1000000; | |
public static double ak(int k) { | |
if (k == 0) return 2; | |
double product = 1; | |
for (int i = k; i < 2*k; i+=2) { | |
product *= ((double) (i+2)) / (i+1); | |
} | |
return Math.pow(product, 1.0 / k); | |
} | |
public static void main(String[] args) { | |
double e = ak(0); | |
for (int i = 2; i < N; i*=2) { | |
e *= ak(i); | |
} | |
System.out.println(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment