MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Pi day

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108340] Re: Pi day
  • From: DC <b.gatessucks at gmail.com>
  • Date: Sun, 14 Mar 2010 05:14:44 -0500 (EST)
  • References: <hng20k$ro0$1@smc.vnet.net>

Not elegant and probably slow :

digits = Permutations[{1, 2, 3, 4, 5, 6, 7, 8, 9}, {9}];

factors = 10^# & /@ Range[8, 0, -1];

possibilities = (#.factors) & /@ digits;

output = Flatten[
    Outer[{#1, #2, Abs[#1/#2 - \[Pi]]} &, possibilities, possibilities,
      1, 1], 1];

SortBy[output, #[[3]] &] // First // N
SortBy[output, #[[3]] &] // Last // N


-Francesco

On 03/13/2010 12:55 PM, Tom wrote:
> Hello,  I am a high school math teacher and the following puzzle was
> posed by a few math teachers I am in contact with.
>
> Create a fraction whose numerator has the digits 1 - 9 (used once)
> and whose denominator has the digits 1 - 9  (used one) .
>
> Which fraction has a value closest to the value of pi?
>
> I've worked on some "brute force" checks and managed to check all
> possible fractions with 2,3,4,5 and 6 digits.   But after that, there
> are just too many possibilities.
>
> I don't have the programming ability to implement something elegant in
> Mathematica.
>
> Is there anyone who could suggest an approach to find the solution to
> this?
>
> Sincerely,
>
> Tom
>


  • Prev by Date: Re: Plot not working correctly
  • Next by Date: Re: Putting controls next to graphics in the Manipulate Display area
  • Previous by thread: Re: Pi day
  • Next by thread: Re: Re: Pi day