Periods of Reciprocals of Integers
|
08-06-2018, 12:59 AM
Post: #3
|
|||
|
|||
RE: Periods of Reciprocals of Integers
(08-05-2018 08:49 PM)Thomas Klemm Wrote: There are probably more efficient ways to calculate the smallest integer \(k\) such that \(10^k\equiv1(\mod n)\) since Hi, Thomas, Your code is pretty good. Factoring number is hard. A slight optimization is to check if p==n-1 too, and return k+k The code with factoring (factor() not shown) look like this: Code: def order(a, n): # assumed gcd(a, n) = 1 Code: def period(n): |
|||
« 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: 5 Guest(s)