Request for "Decimal Period of 1/X in Base Y" program
|
03-01-2015, 10:17 PM
(This post was last modified: 03-01-2015 10:20 PM by Gerald H.)
Post: #21
|
|||
|
|||
RE: Request for "Multiplicative Order of Y (mod X)" program
If you want to do it for any base, instead of removing 2s & 5s, remove any factors of that base & change the 10 near the end for the required base - I believe that will solve it.
It might be an idea to change title of thread so others can find solution to length of period problem. |
|||
03-02-2015, 07:09 AM
Post: #22
|
|||
|
|||
RE: Request for "Decimal Period of 1/X in Base Y" program
(03-01-2015 10:17 PM)Gerald H Wrote: If you want to do it for any base, instead of removing 2s & 5s, remove any factors of that base & change the 10 near the end for the required base - I believe that will solve it. Will try that. I hope it's a valid method, because that's the method used by my URPL program, but it's much slower than yours. Quote:It might be an idea to change title of thread so others can find solution to length of period problem. Good idea. Done. <0|ɸ|0> -Joe- |
|||
03-02-2015, 08:10 AM
Post: #23
|
|||
|
|||
RE: Request for "Decimal Period of 1/X in Base Y" program
(03-01-2015 05:40 PM)Joe Horn Wrote:(02-27-2015 09:57 AM)Gerald H Wrote: IF you're only interested in integer values for X & Y, this 50G prog does the job: ... Sorry, it's a custom EXTABLE for ROM 2.10-7. Yes, Z0_ is ZINT 0. |
|||
03-02-2015, 10:33 AM
Post: #24
|
|||
|
|||
RE: Request for "Decimal Period of 1/X in Base Y" program
(03-02-2015 07:09 AM)Joe Horn Wrote:(03-01-2015 10:17 PM)Gerald H Wrote: If you want to do it for any base, instead of removing 2s & 5s, remove any factors of that base & change the 10 near the end for the required base - I believe that will solve it. OK, how about this prog: « WHILE DUP PICK3 GCD DUP 1 > REPEAT / END DROP SWAP ORD » |
|||
01-21-2018, 09:17 PM
(This post was last modified: 01-21-2018 09:34 PM by StephenG1CMZ.)
Post: #25
|
|||
|
|||
RE: Request for "Decimal Period of 1/X in Base Y" program
(02-27-2015 08:49 AM)Thomas Ritschel Wrote: Here is a simple non-CAS variant: I am using this procedure to analyze repeating decimals/recurring decimals here: http://www.hpmuseum.org/forum/thread-9986.html Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
01-26-2018, 11:32 PM
Post: #26
|
|||
|
|||
RE: Request for "Decimal Period of 1/X in Base Y" program
I now have an optimised version of MultiplicativeOrder for base 10 on the Prime here:
http://www.hpmuseum.org/forum/thread-9986.html Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
08-11-2019, 07:00 PM
(This post was last modified: 08-13-2019 09:55 PM by Albert Chan.)
Post: #27
|
|||
|
|||
RE: Request for "Decimal Period of 1/X in Base Y" program
(03-01-2015 06:17 PM)Joe Horn (post 18) Wrote: Uh oh. Running it after 12 ENTER 23 yields 22, but the correct answer for the period of 1/23 in base 12 The code for order(a,n) were wrong. order(12,23) = 11, matching repeating decimals period. GCD does 2 duties: satisfy order() co-prime arguments requirement, and to track where to put the "decimal" point. Example, 1/360 to base 12 12/360 = 1/30 12/30 = 2/5 Stop further scaling since gcd(12,5) = 1 order(12,5) = 4 12^4-1 = 20735 2/5 = (20735*2/5) / 20735 = 8294/20735 = 4972/BBBB (base 12) 1/360 = 0.00 \(\overline{4972}\) (base 12) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 7 Guest(s)