Digits Of E
June 19, 2012

modulus 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 


2 
initialization 
1 
1 
1 
1 
1 
1 
1 
1 
1 
1 



times ten 
10 
10 
10 
10 
10 
10 
10 
10 
10 
10 

carry 
4 
3 
2 
1 
1 
1 
1 
1 
0 


sum 
14 
13 
12 
11 
11 
11 
11 
11 
10 
10 
7 
quotient 
7 
4 
3 
2 
1 
1 
1 
1 
1 
0 

remainder 
0 
1 
0 
1 
5 
4 
3 
2 
0 
10 



times ten 
0 
10 
0 
10 
50 
40 
30 
20 
0 
100 

carry 
3 
0 
3 
9 
6 
4 
2 
0 
9 


sum 
3 
10 
3 
19 
56 
44 
32 
20 
9 
100 
1 
quotient 
1 
3 
0 
3 
9 
6 
4 
2 
0 
9 

remainder 
1 
1 
3 
4 
2 
2 
0 
2 
9 
1 



times ten 
10 
10 
30 
40 
20 
20 
0 
20 
90 
10 

carry 
6 
9 
8 
3 
2 
0 
3 
9 
0 


sum 
16 
19 
38 
43 
22 
20 
3 
29 
90 
10 
8 
quotient 
8 
6 
9 
8 
3 
2 
0 
3 
9 
0 

remainder 
0 
1 
2 
3 
4 
6 
3 
2 
0 
10 



times ten 
0 
10 
20 
30 
40 
60 
30 
20 
0 
100 

carry 
5 
6 
7 
8 
9 
4 
2 
0 
9 


sum 
5 
16 
27 
38 
49 
64 
32 
20 
9 
100 
2 
quotient 
2 
5 
6 
7 
8 
9 
4 
2 
0 
9 

remainder 
1 
1 
3 
3 
1 
1 
0 
2 
9 
1 



times ten 
10 
10 
30 
30 
10 
10 
0 
20 
90 
10 

carry 
6 
9 
6 
1 
1 
0 
3 
9 
0 


sum 
16 
19 
36 
31 
11 
10 
3 
29 
90 
10 
8 
quotient 
8 
6 
9 
6 
1 
1 
0 
3 
9 
0 

remainder 
0 
1 
0 
1 
5 
3 
3 
2 
0 
10 



times ten 
0 
10 
0 
10 
50 
30 
30 
20 
0 
100 

carry 
3 
0 
3 
9 
4 
4 
2 
0 
9 


sum 
3 
10 
3 
19 
54 
34 
32 
20 
9 
100 
1 
quotient 
1 
3 
0 
3 
9 
4 
4 
2 
0 
9 

remainder 
1 
1 
3 
4 
0 
6 
0 
2 
9 
1 



times ten 
10 
10 
30 
40 
0 
60 
0 
20 
90 
10 

carry 
6 
9 
8 
1 
8 
0 
3 
9 
0 


sum 
16 
19 
38 
41 
8 
60 
3 
29 
90 
10 
8 
quotient 
8 
6 
9 
8 
1 
8 
0 
3 
9 
0 

remainder 
0 
1 
2 
1 
2 
4 
3 
2 
0 
10 



times ten 
0 
10 
20 
10 
20 
40 
30 
20 
0 
100 

carry 
5 
5 
2 
4 
6 
4 
2 
0 
9 


sum 
5 
15 
22 
14 
26 
44 
32 
20 
9 
100 
2 
quotient 
2 
5 
5 
2 
4 
6 
4 
2 
0 
9 

remainder 
1 
0 
2 
4 
2 
2 
0 
2 
9 
1 



times ten 
10 
0 
20 
40 
20 
20 
0 
20 
90 
10 

carry 
2 
7 
8 
3 
2 
0 
3 
9 
0 


sum 
12 
7 
28 
43 
22 
20 
3 
29 
90 
10 
6 
quotient 
6 
2 
7 
8 
3 
2 
0 
3 
9 
0 

remainder 
0 
1 
0 
3 
4 
6 
3 
2 
0 
10 
Like this:
Like Loading...
Related
Pages: 1 2 3
Posted by programmingpraxis
[…] today’s Programming Praxis exercise, our goal is to implement two algorithms to calculate the digits of e […]
Here’s my Haskell solution for the first algorithm (since my solution for the second one has already been posted in the exercise). A version with comments can be found at http://bonsaicode.wordpress.com/2012/06/19/programmingpraxisdigitsofe/ .
[…] First we reuse the unbounded spigot algorithm for calculating e from the last exercise; […]
Does anybody share a Java or C# code for this exercises?
Basically a direct translation of the haskell code into Python 2.7. I create the input stream and initialize the state vector (z) in ‘stream()’ and eliminated ‘streamDigits()’.
Here is FORTH code for the first algorithm (by Stan & Stanley) Though space is proportional to n, not sure why you mention n**2.