To: [EMAIL PROTECTED]
Subject: Mersenne: n-th decimal digit in real number
Date: Tue, 09 Oct 2001 15:09:08 -0700
Mime-Version: 1.0
Content-Type: text/plain; format=flowed
Message-ID: <[EMAIL PROTECTED]>
X-OriginalArrivalTime: 09 Oct 2001 22:09:08.0593 (UTC) FILETIME=[048F1610:01C1510F]
Sender: [EMAIL PROTECTED]
Precedence: bulk
Status: R


"Robert Braunwart" <[EMAIL PROTECTED]> wrote


>What do you think the best is the best approach for this problem?
>
>Calculate the n th. (any number) decimal digit of the expansion of a
>regular rational 1/n (not necessarily the same n), with n a prime number,
>without calculating the preceding digits.
>

       Let x be a positive real number.  
If d is the n-th decimal digit of x, then

         d is an integer
         0 <= d <= 9
         FLOOR(10^n * x) == d (mod 10)

For example, if x = sqrt(2) = 1.4142135 ..., and n = 4, then

          FLOOR(10^4 * x) = FLOOR(14142.135 ...) = 14142.

Reduce this modulo 10, to find the fourth decimal digit
(to the right of the decimal point) is a 2.


>Please give a example using substitution into formula.


      If r is a rational number, say r = r1/r2, 
with r1, r2 positive integers, then

        FLOOR(10^n * r) mod 10 
      = FLOOR(10*(r1*10^(n-1) mod r2)/r2)

For example, to get the fourth decimal digit of 3/7, evaluate
3 * 10^3 mod 7 = 3000 mod 7 = 4.
FLOOR(10*4/7) = FLOOR(40/7) gives 5, which agrees with 3/7 = .428571 ...


_________________________________________________________________________
Unsubscribe & list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ      -- http://www.tasam.com/~lrwiman/FAQ-mers

Reply via email to