Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

It's eeeeeeeeeee e as pi

13 views
Skip to first unread message

Carl G.

unread,
Jan 19, 2006, 3:13:19 PM1/19/06
to
Using only the constant e (the base of natural logarithms, 2.71828...) a
dozen times, plus addition, multiplication, subtraction, division,
exponentiation, and parentheses, create an expression that comes as close as
possible to the value of pi (3.14159...). Other operations or constants are
not allowed (no roots, absolute values, imaginary numbers, etc.). The
constant e must appear exactly twelve times.

For example:

(e+e+e+e+e+e)/(e+e)+e+e-e-e = 3

Which differs from pi by less than 0.15. I'm sure than someone can do
better.

Carl G.


swp

unread,
Jan 19, 2006, 3:47:16 PM1/19/06
to
hmmm. can it be done in reverse as well? that is, use just pi a
certain number of times to make a value close to e?

e^pi = pi^e + e/pi - pi/e + 1 (give or take a little)

swp

Duke

unread,
Jan 19, 2006, 3:53:19 PM1/19/06
to
How about

(e * e * e * e / e) / ((e + e + e + e + e + e)/e) = 3.348, off by about
6.6%.

Duke Lefty

Reinhold Burger

unread,
Jan 19, 2006, 4:08:00 PM1/19/06
to

((e+e)/e + e/e + e - e + e - e + e + e)/e = 3.103638324

Differs from pi by less than 0.038, though I'm sure others will do better.

Reinhold

Reinhold Burger

unread,
Jan 19, 2006, 4:18:47 PM1/19/06
to

Slightly better:

e + e - (e^(e)/e/e/e/e) - e/e - e/e = 3.159003661

Differs from pi by less than 0.0175

Reinhold

Reinhold Burger

unread,
Jan 19, 2006, 4:28:29 PM1/19/06
to

On Thu, 19 Jan 2006, Carl G. wrote:


Okay, this is enough from me for a while...

(e+e)/(e+e) + e/e + e/e + e/(e*e*e) = 3.135335283

Differs from pi by less than 0.0063

Reinhold

Jerry Donovan

unread,
Jan 19, 2006, 4:42:24 PM1/19/06
to
"Reinhold Burger" <rfbu...@cs.uwaterloo.ca> wrote in message
news:Pine.GSO.4.64.06...@fe02.math.uwaterloo.ca...

How about (e+e+e)/e+(e/(e+e+e+e+e+e+e)) = 3.142857143

That differs by 0.0012645

Jerry


Reinhold Burger

unread,
Jan 19, 2006, 4:49:31 PM1/19/06
to

On Thu, 19 Jan 2006, Jerry Donovan wrote:

> How about (e+e+e)/e+(e/(e+e+e+e+e+e+e)) = 3.142857143
>
> That differs by 0.0012645
>
> Jerry


I see... 3 1/7. Very clever :)

Reinhold

Pedro Graca

unread,
Jan 19, 2006, 8:17:07 PM1/19/06
to
Carl G. wrote:
> Using only the constant e (the base of natural logarithms, 2.71828...) a
> dozen times, plus addition, multiplication, subtraction, division,
> exponentiation, and parentheses, create an expression that comes as close as
> possible to the value of pi (3.14159...). Other operations or constants are
> not allowed (no roots, absolute values, imaginary numbers, etc.). The
> constant e must appear exactly twelve times.

(e + (e + (e + (e + e)))) ^ ((e - (e / (e + (e + e)))) / (e + e))

(5e) ^ ((e - 1/3) / 2e) = 3.141580 (PI - 0.000013)

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!

Richard Heathfield

unread,
Jan 19, 2006, 11:45:49 PM1/19/06
to
Carl G. said:

> The constant e must appear exactly twelve times.
>

You have to use your imagination a bit - what looks like "e to the e to the
e to the e to the e" is supposed to be a picture of a section of tree trunk
- but the answer is exact.

e
e
e
e
e -e/e
e
------------

e

e
e
e


--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)

Patrick Hamlyn

unread,
Jan 20, 2006, 6:40:09 AM1/20/06
to
Richard Heathfield <inv...@invalid.invalid> wrote:

>Carl G. said:
>
>> The constant e must appear exactly twelve times.
>>
>
>You have to use your imagination a bit - what looks like "e to the e to the
>e to the e to the e" is supposed to be a picture of a section of tree trunk
>- but the answer is exact.
>
> e
> e
> e
> e
> e -e/e
> e
> ------------
>
> e
>
> e
> e
> e


why not just

e e e e e
e e
e e

e e
--
Patrick Hamlyn posting from Perth, Western Australia
Windsurfing capital of the Southern Hemisphere
Moderator: polyforms group (polyforms...@egroups.com)

[Jongware]

unread,
Jan 20, 2006, 11:36:14 AM1/20/06
to
"Patrick Hamlyn" <path@multipro.N_OcomSP_AM.au> wrote in message
news:dvi1t158snr4nleti...@4ax.com...

> Richard Heathfield <inv...@invalid.invalid> wrote:
>
>>Carl G. said:
>>
>>> The constant e must appear exactly twelve times.
>>>
>>
>>You have to use your imagination a bit - what looks like "e to the e to
>>the
>>e to the e to the e" is supposed to be a picture of a section of tree
>>trunk
>>- but the answer is exact.
>>
>> e
>> e
>> e
>> e
>> e -e/e
>> e
>> ------------
>>
>> e
>>
>> e
>> e
>> e
>
>
> why not just
>
> e e e e e
> e e
> e e
> e e

... this is not a correct answer.
it doesn't satifsy the condition 'twelve times'.

--
[Jongware]
Minds, like parachutes, function best when open


Jonathan

unread,
Jan 20, 2006, 11:58:38 AM1/20/06
to
Patrick Hamlyn wrote:
>
>
> why not just
>
> e e e e e
> e e
> e e
> e e

Or we can try something like this:

eeeeeeeeeee
+ /+
+ * * */ +
+ / /
+ * */ */
+ / / / e
+* */ */
+ / /
+ */ */
+ / /
+/--/

dhrm77

unread,
Jan 20, 2006, 2:50:32 PM1/20/06
to
"Carl G." <cginnowze...@microprizes.com> wrote in message
news:5qSzf.4$j3...@dfw-service2.ext.ray.com...
This is what I found manually :

(e+e+e)/e + (e/(e+e+e+e+e+e+e)) = 3.142857142857 ( differs by 0.0012644...)
and
(e+e+e)/e + ( e+ (e/e)/(e+e) ) / (e*e*e ) = 3.142073... ( differs by
0.00048... )

Then I wrote a program, and this is what I found so far :

((e*((e*e)-e))-e)/(e+(e/(e+e+(e/(e+e))))) = 3.141582230720...( differs by
0.000010424 )
but the program hasn't check all combinations yet..


Pedro Graca

unread,
Jan 20, 2006, 6:17:02 PM1/20/06
to
dhrm77 wrote:
> "Carl G." <cginnowze...@microprizes.com> wrote in message
> news:5qSzf.4$j3...@dfw-service2.ext.ray.com...
>> [snip: use twelve e (2.718281...) to reach pi (3.14159...)

>
> I wrote a program, and this is what I found so far :
>
> ((e*((e*e)-e))-e)/(e+(e/(e+e+(e/(e+e))))) = 3.141582230720...( differs by
> 0.000010424 )
> but the program hasn't check all combinations yet..

I left my program running on the work machine for the weekend.
Before I left it had found

(((e+(e+e))/((e+e)-(((e/((e*e)-e))^e)/e)))^e)

3.141593217678 ~= PI + 0.000000564088


I hope to have a few more decimal places Monday morning :-)

Mark Brader

unread,
Jan 21, 2006, 4:55:21 AM1/21/06
to
> > Using only the constant e (the base of natural logarithms, 2.71828...) a
> > dozen times, plus addition, multiplication, subtraction, division,
> > exponentiation, and parentheses, create an expression that comes as close
> > as possible to the value of pi (3.14159...). Other operations or constants
> > are not allowed ...

> Then I wrote a program, and this is what I found so far :
>
> ((e*((e*e)-e))-e)/(e+(e/(e+e+(e/(e+e))))) = 3.141582230720...( differs by
> 0.000010424 )
> but the program hasn't check all combinations yet..

I wrote a program too, but wasn't surprised when it ran out of memory
well before getting to expressions with 12 instances of e. In fact
it only got as far as 9 instances. Perl is not a memory-efficient
language. For those who may be interested, here's how far it got;
I believe the output should be self-explanatory.

Level 2: 5 values
1.0000000000000000 (e/e)
5.4365636569180902 (e+e)

Level 3: 26 values
2.7182818284590451 (e+(e-e))
3.7182818284590451 (e+(e/e))

Level 4: 157 values
3.0861612696304874 (e+((e/e)/e))
3.2182818284590451 (e+(e/(e+e)))

Level 5: 1013 values
3.0861612696304870 (((e/e)+(e*e))/e)
3.1639534137386529 ((e+e)/(e-(e/e)))

Level 6: 6842 values
3.1406006267105635 (e+(e/(e+(e+(e/e)))))
3.1421918339232748 (e^(e^(((e/e)/e)/e)))

Level 7: 47960 values
3.1408813053164222 (e^(((((e^e)/e)-e)/e)^e))
3.1418075994978536 (e+(e^((e-(e*e))/(e+e))))

Level 8: 344412 values
3.1414574577355028 (e+(e^(((e^e)/(e+(e+e)))-e)))
3.1418075994978536 (e+(e/(e^((e+(e*e))/(e+e)))))

Level 9: 2522187 values
3.1415537373379094 ((((e-(e/(e^e)))^e)-e)^(e/(e+e)))
3.1416122743372439 ((e^(((e-(e/e))^e)-e))-((e+e)/e))

And here's the program, in case it inspires someone else to do better.


#!/usr/bin/perl

use warnings;
use strict;

# This is called with two arguments which are references to lists of
# arbitrary length, whose members are references to sublists consisting
# of a numerical value and a string which is an algebraic expression.
# It produces a single list in the same format by taking each number in
# one list in combination with each in the other and doing each permitted
# operation that produces a defined result.

sub combine {
my ($L, $R) = @_;
my @result;

foreach my $lpair (@$L) {
my ($lval, $lex) = @$lpair;
foreach my $rpair (@$R) {
my ($rval, $rex) = @$rpair;
push @result, [$lval + $rval, "($lex+$rex)"],
[$lval * $rval, "($lex*$rex)"],
[$lval - $rval, "($lex-$rex)"],
[$rval - $lval, "($rex-$lex)"];
push @result, [$lval / $rval, "($lex/$rex)"] if ($rval);
push @result, [$rval / $lval, "($rex/$lex)"] if ($lval);

my $tmp = $lval**$rval; # may produce "Inf" or "NaN"
push @result, [$tmp, "($lex^$rex)"] if ($tmp !~ /[A-Za-z]/);
$tmp = $rval**$lval;
push @result, [$tmp, "($rex^$lex)"] if ($tmp !~ /[A-Za-z]/);
}
}
return simplify (@result);
}

# This sorts the list and strips repeated values out. Values within a
# ratio of 1.00000001 are assumed to be identical.

sub simplify {
my @result;
my $prev;

foreach my $pair (sort { $a->[0] <=> $b->[0] } @_) {
my $val = $pair->[0];
if (defined $prev) {
next if ($val == $prev);
if ($val) {
my $tmp = $prev / $val;
next if ($tmp > 0.99999999 && $tmp < 1.00000001);
}
}

$prev = $val;
push @result, $pair;
}

return @result;
}

# And now the mainline...

use constant N => 12;

my $pi = atan2(1,0) * 2;
my $e = exp(1);

my @level = (undef, [[$e, "e"]]);

for (my $i = 2; $i <= N; ++$i) {

my @list;
for (my $j = 1; $j < $i; ++$j) {
push @list, combine($level[$j], $level[$i - $j]);
}
$level[$i] = my $tmp = [simplify(@list)];

print "\nLevel $i: ", scalar(@{$level[$i]}), " values\n";

for (my $k = 0; $k < @$tmp - 1; ++$k) {
if ($tmp->[$k]->[0] <= $pi && $tmp->[$k + 1]->[0] >= $pi) {
printf("%.16f %s\n", @{$tmp->[$k]});
printf("%.16f %s\n", @{$tmp->[$k + 1]});
last;
}
}
}
--
Mark Brader, Toronto | This is Programming as a True Art Form, where style
m...@vex.net | is more important than correctness... --Pontus Hedman

My text in this article is in the public domain.

Pedro Graca

unread,
Jan 23, 2006, 6:17:02 AM1/23/06
to
Pedro Graca wrote:
> dhrm77 wrote:
>> "Carl G." <cginnowze...@microprizes.com> wrote in message
>> news:5qSzf.4$j3...@dfw-service2.ext.ray.com...
>>> [snip: use twelve e (2.718281...) to reach pi (3.14159...)
>>
>> I wrote a program, and this is what I found so far :
<snip>

>> but the program hasn't check all combinations yet..
>
> I left my program running on the work machine for the weekend.
<snip>

> I hope to have a few more decimal places Monday morning :-)

... only one more decimal place

((e+(e+e))/((((((e*e)-e)-((e+e)/e))^e)/e)-e))

3.141592585646 = (PI - 0.000000067944)


Program's last output was:

C:\Projects\e12\Release>e12 "++++/*+/-/^"
eeeeeeeeeeee++++/*+/-/^ = 4.2295632142574942 (1.0879705606677010)
eeeeeeeeeee++++e/*+/-/^ = 2.9017619017847989 (0.2398307518049943)
eeeeeeeeee+++ee+/*+/-/^ = 3.1260349807458985 (0.0155576728438946)
eeeeee+eeee+++/ee*+/-/^ = 3.1429371694684298 (0.0013445158786367)
ee+eeeeee+++/*+eee/-e/^ = 3.1415811378667367 (0.0000115157230565)
eee+eee++ee+e/e^e/-/e^/ = 3.1415999802576766 (0.0000073266678835)
eeeee+eee+eee++e^/^+/*^ = 3.1415990939793392 (0.0000064403895461)
eeeee++eeee+-*+^ee/-e/+ = 3.1415975492094343 (0.0000048956196412)
eee+eeeeee++-/ee*+/e^^^ = 3.1415915658408951 (0.0000010877488981)
eee+ee+eee+-^*ee*ee^-*- = 3.1415916076895285 (0.0000010459002646)
a) eee++ee+eee*e-/e^e/-/e^ = 3.1415932176784089 (0.0000005640886158)
eee++ee*eee+e/+-e^e/e-/ = 3.1415925856456290 (0.0000000679441641)
eee++ee*ee+e/-e-e^e/e-/ = 3.1415925856456326 (0.0000000679441605)
b) eee++ee*e-ee+e/-e^e/e-/ = 3.1415925856456344 (0.0000000679441587)
c) SIGINT caught! (2)
I was dealing with the operators +-**/^/////

Exiting ...

a) Friday afternoon
b) sometime between a) and Monday morning
c) Monday morning

For anyone interested, the
C code is available at <http://pastebin.com/518845>

Fred the Wonder Worm

unread,
Jan 23, 2006, 9:35:48 PM1/23/06
to
Carl G. wrote:
> Using only the constant e (the base of natural logarithms, 2.71828...) a
> dozen times, plus addition, multiplication, subtraction, division,
> exponentiation, and parentheses, create an expression that comes as close as
> possible to the value of pi (3.14159...). Other operations or constants are
> not allowed (no roots, absolute values, imaginary numbers, etc.). The
> constant e must appear exactly twelve times.

My best so far (computer aided search, truncated due to lack of memory)
is

(e^(e + e*e/e^e))/e - e - e - e/(e + e) = 3.1415926961299-

with a difference of approximately 4.254+*10^-8.

Cheers,
Geoff.

-----------------------------------------------------------------------------
Geoff Bailey (Fred the Wonder Worm) | Programmer by trade --
ft...@maths.usyd.edu.au | Gameplayer by vocation.
-----------------------------------------------------------------------------

John R Jones

unread,
Jan 24, 2006, 6:50:01 AM1/24/06
to
Marvellous! What was the search algorithm - I worked out there were
10^11 possible combinations and stopped right there.
JJ

Fred the Wonder Worm

unread,
Jan 26, 2006, 10:12:53 PM1/26/06
to
John R Jones wrote:
> Marvellous! What was the search algorithm - I worked out there were
> 10^11 possible combinations and stopped right there.

[ Sorry for the delay, half the time the combination of Google and
my browser seems to swallow my posts. :( ]

Brute force, pretty much. I successively generated all values using
1 e, then 2 e's, etc., until I ran out of memory (which happened when
trying to find values using 9 e's). To keep things simple, I made
the following reductions:

1) Don't keep anything larger than 100 or smaller than 10^-9 as these
are less likely to be useful.
2) Only keep the positive values -- 0 is only useful to burn an e, and
the negatives are only required in exponents, so instead remember
to use both x^y and x^-y when forming new values.
3) Since (x^y)^z = x^(y*z), don't use a^b when a is already c^d. To
do this, tag each expression with the operator that was used to
make it. One wants this in any case to go back and find the
expression from the value.

Given the partial values I had, I then searched for pairs x,y such
that x op y was close to pi with x using k e's and y using 12-k e's.
Since I only had lists up to 8 e's, k was in [4..8]. (Of course, I
sorted the values in each list first so that this search was linear
rather than quadratic.)

The particular value I posted came from (7 e's) - (5 e's), which
seemed better than anything I got trying both 6s or a 4/8 split. I
also tried looking for values close to log(pi), pi/e, e/pi, pi*e (but
I forgot to try pi - e and pi + e, now that I think about it) among
the 3/8, 4/7, and 5/6 splits, but didn't get anything better.

John R Jones

unread,
Jan 27, 2006, 4:29:22 AM1/27/06
to
> Brute force, pretty much. I successively generated all values using
> 1 e, then 2 e's, etc., until I ran out of memory (which happened when
> trying to find values using 9 e's). To keep things simple, I made
> the following reductions
> ...


Very astute - I knew some pruning would be necessary but didnt put
anything like as much thought into it as yourself.
I would guess you have access to loads of memory!
Many thanks for the explanation.
JJ

0 new messages