Periods of Reciprocals of Integers
|
08-06-2018, 02:05 PM
Post: #5
|
|||
|
|||
RE: Periods of Reciprocals of Integers
(08-06-2018 03:37 AM)Thomas Klemm Wrote:(08-06-2018 12:59 AM)Albert Chan Wrote: A slight optimization is to check if p==n-1 too, and return k+k Hi, Thomas: If p==n-1 exist, you can deduce the other half digits with 9-complements To show why it work, i use a simpler fraction, say 1/13: 10^3 (mod 13) = 12, so period = 2*3 = 6 Firsrt 3 repeating digits of 1/13 = floor(1e3/13) = 076 To get the other half repeating digits d: 76000/999999 + d/999999 = 1/13 = 77/1001 76000 + d = 77*999 = (76+1)(1000-1) = 76000 + 1000 - 76 - 1 d = 999 - 76 = 923 -> 1/13 = 0.076 923 A harder example 3/17, 10^8 (mod 17) = 16, so period = 2*8 = 16 First 8 repeating digits of 3/17 = floor(3e8/17) = 17647058 --> 3/17 = 0.17647058 82352941 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Periods of Reciprocals of Integers - Macumazahn - 12-30-2017, 02:19 PM
RE: Periods of Reciprocals of Integers - Thomas Klemm - 08-05-2018, 08:49 PM
RE: Periods of Reciprocals of Integers - Albert Chan - 08-06-2018, 12:59 AM
RE: Periods of Reciprocals of Integers - Thomas Klemm - 08-06-2018, 03:37 AM
RE: Periods of Reciprocals of Integers - Albert Chan - 08-06-2018 02:05 PM
RE: Periods of Reciprocals of Integers - Thomas Klemm - 08-06-2018, 05:30 PM
RE: Periods of Reciprocals of Integers - Albert Chan - 08-06-2018, 07:41 PM
|
User(s) browsing this thread: 7 Guest(s)