Easy as Pi

Copyright ©1999 by Paul Niquette. All rights reserved

Given three decimal ciphers x, y, z, find a ratio
x y y / z z x
that approximates the value of pi
to better than one part in 10 million.
It is always possible to find a rational approximation for an irrational number to any desired degree of precision. For example,...

π   31,415,927 / 10,000,000,

...but that takes eight ciphers to express, hardly making it as Easy as Pi to remember.

For the puzzle as stated, xyy / zzx,  a reasonable assumption is that all three ciphers x, y, z are distinct from each other. We observe that none of the three ciphers can be zero.

  • If x = 0, then 0yy/zz0 ~~~~~~ largest value = 99/110 = 0.9 000...
  • If y = 0, then x00/zzx ~~~~ closest value = 700/227 = 3.0837...
  • If z = 0, then xyy/00x = yy ~~~~~~~~~~ smallest value = 11.0...
That leaves 9 * 8 * 7 or 504 combinations of values to consider. Let's get to work.

To get a quotient greater than 3, x has to be at least 3. The smallest value for z is 1, which means that the smallest denominator of the fraction is 113. The fraction, then has the form 3yy/113. We break out our calculators and merely test appropriate values of y as follows:

  • For y = 1, y = z ~~~~~~~~~~~~~~~~~~~~~~~~~~~ not distinct.
  • For y = 2, xyy/zzx = 322/113 = 2.849557522 ~~~~~ not even close.
  • For y = 3, y = x ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ not distinct.
  • For y = 4, xyy/zzx = 344/113 = 3.044247788 ~~~~~ not close enough.
  • For y = 5, xyy/zzx = 355/113 = 3.141592920... ~~~~~~~~~~  hoo-hah!
     
    π 355 / 113
Now, the puzzle was actually derived using a spreadsheet {Hypernote}. There are two ratios of 3-digit integers that approximate π with the specified accuracy, but only one 3-cipher approximation. It was an accidental discovery, and its solution here is Easy as Pi.
 



Background

owever irrational,  π is surely mankind's favorite constant. Its value has been approximated to a billion digits; nevertheless, "squaring the circle" remains an unsolved problem in mathematics. By the way, according to an urban legend based on a clever April Fools prank, Alabama attempted to legislate an integer value for π that would make it more convenient for finding circumferences and arcs and circular areas.

Back in the mid-twentieth century, a sophisticated solver had only a slide rule for arithmetic operations and was limited to three digits of accuracy.

The value of π was often approximated as 22/7. Any modern calculator will show that 22/7 = 3.142857142857..., which is accurate to only about 4 parts in 10,000 or 0.04%.

That same calculator will confirm that 355/113 = 3.141592920..., which differs from 3.141592654... by less than one part in 10 million or 0.0000085%. To put that precision in perspective, if the earth were a perfect sphere with a diameter of 8,000 miles, its circumference could be estimated, using = 355/113 with an error of no more than 11 feet 31/4 inches. {Return}


Making the Irrational Rational -- Almost

The sophisticated solver knows how to use a spreadsheet to create an interactive 'model' of a problem. Here is one way to approximate any irrational number N by a rational number R, which is the ratio of two integers, call them Numerator and Denominator, which are 'mutually prime' (without common factors) to any specified degree of precision P.

Spreadsheet conventions include

    columns designated by letters A, B,...
    rows designated by numbers 1, 2...
    fixed or non-relative addressing requires a preceding $
    arithmetic operators +, -, *, /, int
    logical operations if(condition, do this, else do that), min(range)
Let A1 = N [as accurately defined as possible]
Let A2 = P [for example P = 0.000001 means '1 part per million']
Let B1 = Numerator [arbitrary 'Seed': for example B1 = 1 (to be changed later)]
Write B2 = B1+1, B3 = B2 +1,... B100 = B99 +1 [100 trial Numerators]
Write C1 = int(B1 / A$1 + 0.5) [generates the first trial Denominator]
    B1 / A$1 generates a non-integer Denominator
    int( ) selects the integer part of a number, but watch out: int(2.1) = int(2.9) = 2.
    + 0.5 enable int( ) to 'round-off': int(2.4 + 0.5) = 2; int (2.5 + 0.5) = 3.
    for N and B1 = 355, C1 = 113 (check it out)
Write C2 = int(B2 / A$1 + 0.5), ... C100 = int(B100 / A$1 + 0.5)
Write D1 = B1 / C1, D2 = B2 / C2,... D100 = B100 / C100 [100 trial Rs]
Write E1 = (A$1 - D1) / A$1,... E100 = (A$1 - D100) / A$1 [error function]
Write F1 = if(A$2 - abs(E1) < A$2, B1, 99999)
    abs(E1) takes the absolute value of the error function
    A$2 - abs(E1) compares the error to specified precision P
    if the error < P, place the corresponding Numerator in F1
    if the error >= P, place an arbitrarily large number in F1
Write F2 = if(A$2 - abs(E2) < A$2, B2, 99999)...
Write F100 = if(A$2 - abs(E100) < A$2, B100, 99999)...
Write A3 = min(F1..F100)

Your computer automatically generates a batch of one hundred consecutive integer values for the Numerator and divides each one by an integer Denominator producing a ratio R and comparing it with the N.

  • For each R that does not approximate N within the specified precision P, a 99999 will appear in the table at the corresponding row.
  • For any R that does approximate N within the specified precision P, the value of the Numerator will appear in Column F at the corresponding row.
Your computer scans Column F for the smallest value and displays that to you in A3. If you see 99999, you know that no value of R has been qualified in the batch. You then change the value of the Seed Numerator in B1and watch what happens to A3.

The first time you see something other than 99999 in A3, hoo-hah! You then copy A3 into B1 and see the Denominator in C1. Of course you can use bigger batches, if you like. Good practice would give the columns labels, and you may want to compute the value of P from some more convenient representation, say, 'percent error' or 'parts per million.'

Using this method and batches of 1000, a certain puzzle-master found the following solutions to one part in ten million in a matter of minutes:

  • π   355 / 113..........Something to do with a circle
  • Φ 4181 / 6765......Simson's Ratio
  • e 4371 / 1608........Base of the natural logarithms
  • 21/2 3363 / 2378.....Diagonal of a unit square
  • 31/2 7382 / 4262.....Diagonal of a unit cube
  • 21/12 3510 / 3313....Half-tone interval in the equal-tempered music scale


Home Page
Puzzle Page
Math and Models
The Puzzle as a Literary Genre