wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> hard >> Pi from digits 1 through 9
(Message started by: SWF on Mar 30th, 2004, 5:52pm)

Title: Pi from digits 1 through 9
Post by SWF on Mar 30th, 2004, 5:52pm
Find a formula for the closest approximation to [pi] which uses each of the nine digits 1 through 9 exactly once.  The digit 0 is not used. Along with the nine digits, the following are also permitted in the formula (as often as desired):

+  (addition)
-  (subtraction, or negative sign)
*  (multiplcation)
/  (division)
^  (raising to a power)
() (parentheses)
.  (a decimal point, a leading zero is not required for values less than 1)

Digits may also be strung together to form a multiple digit number.

For example, one attempt might be:

3 + 1/7 - (5/6 + .2/9) ^ 48  for an error of 7e-4.

The allowable formulas are pretty much what you can type in on a spreadsheet using only the basic operators.

Title: Re: Pi from digits 1 through 9
Post by Barukh on Mar 31st, 2004, 12:00am
[smiley=blacksquare.gif][hide]
(7^3+12) / (98+4+5+6) for an error of < 2.7e-07
[/hide][smiley=blacksquare.gif]

This certainly may be improved since it doesn't use too many operations.

It seems [hide]one may write a program to try all possible cases[/hide]...

Title: Re: Pi from digits 1 through 9
Post by towr on Mar 31st, 2004, 1:00am
I don't think it's computationally viable to try all possible combinations..
Just single numbers with operators gives 9!*5^8 possibilities, add possible points in front of each number means multiplying this by 2^9. You can also concatenate numbers, further increasing the total.. So there are far more than 7.3 * 10^13 possibilities. It would take weeks if not months to do it on the best available consumer computer..

Title: Re: Pi from digits 1 through 9
Post by Barukh on Mar 31st, 2004, 9:12am

on 03/31/04 at 01:00:54, towr wrote:
I don't think it's computationally viable to try all possible combinations..

Hmm, maybe you are right...  >:(    Still, I believe some clever schemes exist that allow to reduce the number of combinations dramatically.

Here's another one:
[smiley=blacksquare.gif][hide]
(97+( 1+8 )/(3*6+4))^.25, error ~e-9.
[/hide][smiley=blacksquare.gif]

Title: Re: Pi from digits 1 through 9
Post by SWF on Mar 31st, 2004, 5:44pm
That is good Barukh. Your approach appears to be to take some old [pi] approximations:  355/113  and  sqrt(sqrt(97 + 9/22)) and express using the 9 digits. There are more accurate solutions.

Some easier side problems related to Barukh's solutions:

1) Find an expression equal to 355/113 that uses the 9 digits once each, one use of a math operator (division) and one decimal point.

2) Find an expression equal to sqrt(sqrt(97 + 9/22)) which uses the 9 digits once each to create 5 integers (no decimal point in this formula) that are combined with the allowed symbols.

Title: Re: Pi from digits 1 through 9
Post by Barukh on May 4th, 2004, 11:09am
I'd like to revive this thread...  ;D


on 03/31/04 at 17:44:12, SWF wrote:
1) Find an expression equal to 355/113 that uses the 9 digits once each, one use of a math operator (division) and one decimal point.

Do you mean the expression uses a single operation?


Quote:
There are more accurate solutions.

No doubt... I would like to get some insights how to approach them. Any clues, SWF?

Title: Re: Pi from digits 1 through 9
Post by SWF on May 4th, 2004, 9:16pm
Yes, that means a single division.  So it is of the form A/B.

A starting point may be to find the best solution of a given form like A/B or A/(B^C) and choose a form you think might work. I am not sure I have the best possible answer, but using forms that will generate lots of digits to the right of the decimal point are most likely better than something like A+B.

Here are a couple of examples (worse than those given so far, but not bad):

(821/(746-93))^5   (error 4.6e-8 )

3.25- (94/867.1)   (error 1.2 e-8 )

Title: Re: Pi from digits 1 through 9
Post by Barukh on May 7th, 2004, 4:09am
Trying to keep this thread alive (where is my defibrillator?  ;D)


on 03/31/04 at 17:44:12, SWF wrote:
1) Find an expression equal to 355/113 that uses the 9 digits once each, one use of a math operator (division) and one decimal point.

8591/2734.6


Quote:
2) Find an expression equal to sqrt(sqrt(97 + 9/22)) which uses the 9 digits once each to create 5 integers (no decimal point in this formula) that are combined with the allowed symbols.

Here’s my analysis. As stated, the formula should be E1^E2, where E1 equals to 2143/22, and E2 equals to 1/4. If E1 = a/b, then E2 contains 3 numbers, and at least 3 digits, that leaves 6 digits for a and b. But then b must contain the same two digits, which is impossible.

So, I looked at the expressions where E1 contains 3 numbers. I assumed E2 takes just 2 digits, so that E2 =1/4or 2/8. For E1 = (a[pm]b)/c there are not enough digits to represent the fraction.

a/(b[pm]c) is more interesting. It is clear that the only possibility here is for a, b, c  to have 4, 2  and 1 digit, respectively. This gives an “almost solution” (8572/(93-6))^(1/4).

Finally, I considered E1 = a [pm] b/c. That means c is at least 3 digits, leaving 2 and 2 for a and b. Therefore, b < c, which may be only if a = 97 or 98. The first choice gives the required solution (97+63/154)^( 2/8 ).

Interestingly enough, the solution is very close to the one I proposed originally, but it took me a long time to stumble at it.  :-/

Title: Re: Pi from digits 1 through 9
Post by grimbal on May 7th, 2004, 1:19pm
The simplest is probably

85910/27346 = 355/113 = 3.1415929...   error 2.67e-7

Title: Re: Pi from digits 1 through 9
Post by Three Hands on May 7th, 2004, 3:25pm
Well, it would be if you were allowed to use the digit 0 Grimbal...

Don't worry, decimal points are allowed, so something like Barukh's answer (your numbers/10) should do the trick  ;)

Not that I would have figured it out, though, so I'm not sure why I'm the one pointing all of this out...

Title: Re: Pi from digits 1 through 9
Post by SWF on May 7th, 2004, 7:36pm
Very good Barukh! But there is still more defibrilating to do, since there is room for improvement. The real hard part is finding forms that work well, here is another that succeeds in improving the accuracy another step:

A - B / ( C - D / ( E + F ))

This is easier than it looks at first: with so many variables they can't have many digits.

Three Hands is correct- it clearly says in the question that there is no zero, and Barukh gave essentially the same thing in the previous post. If it were permitted to violate some of the conditions of the question you could just use  

4*arctan(1-2-3+5+6-7-8+9)

but an expression meeting the conditions is higher priority than accuracy.

Title: Re: Pi from digits 1 through 9
Post by Barukh on May 10th, 2004, 5:50am

on 05/07/04 at 19:36:01, SWF wrote:
…here is another that succeeds in improving the accuracy another step:

A - B / ( C - D / ( E + F ))

That was giving too much… [smiley=blacksquare.gif][hide] 3.2 – 4/(69 – 5/( 1.7+8 )), error 3.32e-10[/hide][smiley=blacksquare.gif]

And if you ask how I did it: a couple of weeks ago I wrote a program that is capable to go over all possible combinations – just to get convinced (as towr predicted) that it’s totally impractical. But then I added some filters to it – and the exact formula came in just in place to get the answer in less than 10 minutes.

After I saw this formula, I punched my head: what may be more natural to try than this form of repeated fraction? And yes, the one that may succeed should have a denominator divisible by 5…

So, no intelligence involved from my side… As SWF said:


Quote:
The real hard part is finding forms that work well

Maybe, something with exponentiation is even better?

Title: Re: Pi from digits 1 through 9
Post by SWF on May 11th, 2004, 6:01pm
Barukh, if you have found the answer to that last one, go ahead and post it.  I have more improvements.

There is still a way to improve upon 3.3e-10 (the accuracy of that last one), and some thinking instead of straight computation helps. Hint: [hide]Using as few digits as possible, try to match a well known [pi] approximation. Then with the remaining digits, make a very small number which is combined with the other expression to help correct the error[/hide].

Title: Re: Pi from digits 1 through 9
Post by Barukh on May 12th, 2004, 5:29am

on 05/11/04 at 18:01:28, SWF wrote:
Barukh, if you have found the answer to that last one, go ahead and post it.

??? ???? I posted it four days ago…

Your last hint: how simple and beautiful (elementary, Watson!). Using it, I found two more solutions, pushing the accuracy upto 9.75e-11.

Title: Re: Pi from digits 1 through 9
Post by Barukh on May 15th, 2004, 9:38am
While looking for more accurate solutions, I came across the following interesting approximations (which unfortunately are not solutions) involving only integers:

[pi] ~ 10[sqrt]12911499 – 2 (error 2.6e-9)
[pi] ~ 10[sqrt]76350183 – 3 (error 1.78e-9)
[pi] ~ 10[sqrt]345104602 – 4 (error 8.6e-10)
[pi] ~ -10[sqrt]308739922 + 3 (error 1.25e-11)

Title: Re: Pi from digits 1 through 9
Post by SWF on May 16th, 2004, 10:54am

on 05/12/04 at 05:29:39, Barukh wrote:
??? ???? I posted it four days ago…

Sorry, I didn't see it hidden until now. I am also having difficulty finding your solution accurate to 9.75e-11, but that sounds about right for the approach described in the last clue.

Those tenth root solutions are good approximations, but not as close as can be obtained within the rules of the problem.


Title: Re: Pi from digits 1 through 9
Post by Barukh on May 17th, 2004, 1:22am

on 05/16/04 at 10:54:00, SWF wrote:
I am also having difficulty finding your solution accurate to 9.75e-11, but that sounds about right for the approach described in the last clue.

I’ve found the following solutions:

[smiley=blacksquare.gif][hide]
3+ 1/(7 + 2^-4) - ( 6 - 5/8 ) ^ -9, error  2.87e-10
3+ 1/(7 + 2^-4) - 5^-8 / 9.6, error 9.75e-11
[/hide][smiley=blacksquare.gif]


Quote:
Those tenth root solutions are good approximations, but not as close as can be obtained within the rules of the problem.

Wow! Every time I manage to get closer (using your clues), the horizon is still there… Could you at least tell what is the order of magnitude of the best solution you are aware of?

Title: Re: Pi from digits 1 through 9
Post by Leonid Broukhis on May 19th, 2004, 7:37pm
I cannot substantiate it, but I have a feeling that a good approximation might have a form X / Y, where Y is a very big number, e.g. 8^9 or .1^-9, or .1^-(8^9) ;) . This way the numerator does not have to be very precise.

Title: Re: Pi from digits 1 through 9
Post by SWF on May 19th, 2004, 8:35pm
Barukh, your best is numerically the same as one approximation I have, but we both used the digits 1, 2, 3, 4, and 7 in different ways to get the 355/113 term!

You used 3+ 1/(7 + 2^-4)
I used 71/(23-.4)    = 71.0/22.6 = 710/226 = 355/113

Instead of just adding a small term to 355/113, you can make a small modification to the numerator or denominator.  Doing that with my fraction, there is a way to get an error of 3.28e-10 (no better than the approximations you have already found). Perhaps modifying your expression similarly with give a better improvement.

There is a way to reduce error by more than a factor of 10, but since that is my last remaining improvement, I will be more stingy about giving clues.

If that is too hard, another fairly simple expression to try for with error around 8e-9: It contains a 7 digit number and two 1 digit numbers (maybe containing decimal points, e.g.  12.34 would be considered a four digit number).

Title: Re: Pi from digits 1 through 9
Post by Barukh on May 23rd, 2004, 3:47am

on 05/19/04 at 20:35:24, SWF wrote:
If that is too hard, another fairly simple expression to try for with error around 8e-9: It contains a 7 digit number and two 1 digit numbers (maybe containing decimal points, e.g.  12.34 would be considered a four digit number).

[smiley=blacksquare.gif][hide]
(93647.85 + .2) ^ .1, error 8.47e-9
[/hide][smiley=blacksquare.gif]

Title: Re: Pi from digits 1 through 9
Post by Barukh on May 24th, 2004, 6:30am

on 05/19/04 at 20:35:24, SWF wrote:
There is a way to reduce error by more than a factor of 10, but since that is my last remaining improvement, I will be more stingy about giving clues.

OK. Let’s see if I made it this time. I’ve got a couple of improvements, and the best approximation is 6.6e-13.

Title: Re: Pi from digits 1 through 9
Post by SWF on May 31st, 2004, 5:49pm
That is better than the best I have, Barukh!  Of course, I'd like to see your formula.

Title: Re: Pi from digits 1 through 9
Post by Barukh on Jun 1st, 2004, 5:44am

on 05/31/04 at 17:49:34, SWF wrote:
That is better than the best I have, Barukh!  Of course, I'd like to see your formula.

2 ^ (5 ^ .4) - .6 - ((.3 ^ 9) / 7) ^ (.8 ^ .1) for an error 6.6e-13.

Here’s how I’ve found it. I ran all the combinations of 4 digits to get as close to [pi] as possible. There are just 5 combinations with an error less than 10-5. Then, for every such combination, I searched for the best approximation with the remaining five digits.

Interestingly enough, when I reversed the process (i.e. started with all the 5 digit combinations, and then fixing with remaining 4 digits), I didn’t get as close. One example that is better than my last try, is the following:

(4 – .1 + 2^.3)^.7 - 5 ^-8 + 9^-6, error 3.87e-11

And now, SWF, I would like you to present your best solution!  ;D


Title: Re: Pi from digits 1 through 9
Post by Leonid Broukhis on Jun 1st, 2004, 7:32pm

on 06/01/04 at 05:44:02, Barukh wrote:
2 ^ (5 ^ .4) - .6 - ((.3 ^ 9) / 7) ^ (.8 ^ .1) for an error 6.6e-13.


Barukh,

you may want to send this result to Eric Weisstein of mathworld.com,
because your approximation is way better than any pandigital approximation mentioned in http://mathworld.wolfram.com/PiApproximations.html
although it is unclear if decimal fractions without a leading 0 are allowed there.

Title: Re: Pi from digits 1 through 9
Post by SWF on Jun 1st, 2004, 9:58pm
OK, here is the former best formula  :(

( (3^(-14))/2 + .67)^.5 + .9^( -8 )

for an error of 4.2e-12.  

Something about this one is that the digits are not well scrambled:  the first block of numbers contains 1 through 4, second block of numbers contains 5 through 7, and last block of numbers has 8 and 9.  Also the first block of numbers is the first 4 digits of [pi], 3.142, (rounded to 4th digit), but with symbols inserted bewteen.

Title: Re: Pi from digits 1 through 9
Post by Barukh on Jun 2nd, 2004, 9:49am

on 06/01/04 at 19:32:59, Leonid Broukhis wrote:
Barukh,

you may want to send this result to Eric Weisstein of mathworld.com

Yes, I also thought about that... Did you, SWF?

Title: Re: Pi from digits 1 through 9
Post by Grimbal on Jun 4th, 2004, 8:32am
I tried with all digits in order:
(1+2)/((3.4)^(-.5/6)+(.7^8)*.9) = 3.1415926483289662 (err 5.26e-9)



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board