Post Reply 
Periods of Reciprocals of Integers
08-06-2018, 07:41 PM
Post: #7
RE: Periods of Reciprocals of Integers
I wrongly assumed the half digits had written down. Sorry.

For n != 3,6,9, here is an idea:

Instead of searching period and building digits 1 at a time, why not in pairs ?
Multiply by 100 instead of 10, stop if reminder = 1, or 10 (1 digit passed period)

Here is the search for period(n = 17):
1) 100/17 = 05 + 15/17
2) 1500/17 = 88 + 4/17
3) 400/17 = 23 + 9/17
4) 900/17 = 52 + 16/17
5) 1600/17 = 94 + 2/17
6) 200/17 = 11 + 13/17
7) 1300/17 = 76 + 8/17
8) 800/17 = 47 + 1/17 <-- stop, remainder = 1, thus period = 2*8 = 16

1/17 = 0.05 88 23 52 94 11 76 47


Unlike my previous optimization, this always cut search steps in half.
Also, it showed repeating decimals pairs without storing them.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Periods of Reciprocals of Integers - Albert Chan - 08-06-2018 07:41 PM



User(s) browsing this thread: 1 Guest(s)