Message Boards Message Boards

GROUPS:

1/109, Fibonacci, and Fractional Part

Posted 2 months ago
574 Views
|
1 Reply
|
6 Total Likes
|

I saw the following image and thought I'd check it.
enter image description here

Turns out this only works if you use FractionalPart. Both of the following give the same output.

  N[1/109, 106]     
  N[FractionalPart[Total[Table[Fibonacci[n] 1/10^(109-n), {n,1,109}]]], 106]    

0.009174311926605504587155963302752293577981651376146788990825688073394495412844036697247706422018348623853211

The part discarded from the sum is 28699473517541069311761.

Posted 2 months ago

Going off the tweet linked by Shenghui in this post, here's a quick investigation of what's actually happening.

As I noted previously, here is how to compute the period of a repeating decimal like $1/109$:

MultiplicativeOrder[10, 109]
   108

To confirm this result, let's use RealDigits[]:

{{rd}, exp} = RealDigits[1/109]
   {{{9, 1, 7, 4, 3, 1, 1, 9, 2, 6, 6, 0, 5, 5, 0, 4, 5, 8, 7, 1, 5, 5, 
      9, 6, 3, 3, 0, 2, 7, 5, 2, 2, 9, 3, 5, 7, 7, 9, 8, 1, 6, 5, 1, 3, 
      7, 6, 1, 4, 6, 7, 8, 8, 9, 9, 0, 8, 2, 5, 6, 8, 8, 0, 7, 3, 3, 9, 
      4, 4, 9, 5, 4, 1, 2, 8, 4, 4, 0, 3, 6, 6, 9, 7, 2, 4, 7, 7, 0, 6, 
      4, 2, 2, 0, 1, 8, 3, 4, 8, 6, 2, 3, 8, 5, 3, 2, 1, 1, 0, 0}}, -2}

Length[rd]
   108

By convention, RealDigits starts with the first non-zero digit, so something closer to a more natural representation would be something like

FromDigits[{{RotateRight[rd, 2]}, 0}]
   1/109

Now let's do something similar to Ed's calculation, but now explicitly generating the Fibonacci digits in their expected places after the decimal point:

tot = Sum[FromDigits[{{PadLeft[ArrayPad[IntegerDigits[Fibonacci[k]], k - 1], 108]}, 0}], {k, 109}]
   8009174311926605504587155963302752293577981651376146788990825688073394495412844036697247706422018348623853211/999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

Now that's a funny-looking rational. Look at the integer part:

IntegerPart[tot]
   8

and the fractional part:

FractionalPart[tot]
   9174311926605504587155963302752293577981651376146788990825688073394495412844036697247706422018348623853219/999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

and the last one isn't quite the expected $1/109$. However,

diff = % - 1/109
   8/999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

which is a very tiny difference indeed:

N[diff]
   8. * 10^-108

RealDigits[diff]
   {{{8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, -107}

...and this is one way to use Mathematica to show that the tweet was almost, but not quite, right.

POSTED BY: J. M.
Answer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract