e (Euler’s number) is a mathematical constant that is the value of
It can be expressed as the sum of infinite series:
It is an irrational number. And can be computed via the following C code:
#include <stdio.h>
int main() {
int N = 9009;
int n = N, x;
int a[9009];
while (--n) {
a[n] = 1 + 1 / n;
}
for(; N > 9; printf("%d",x)) {
for (n = N--; --n; a[n] = x%n, x = 10 * a[n - 1] + x / n);
}
}
The C computes the e constant and store then in a static array.
Save above C code in e.c and compile it using the following command:
gcc -o e e.c
And then the C program will be compiled into an Linux executable e which you can run to get the value of the Euler’s e constant.
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: Filter out Spam Words using PHP Function
Next Post: Teaching Kids Programming - Reverse a Graph (Adjacency List)
