Puzzle - RPL and others
|
05-07-2021, 10:35 AM
(This post was last modified: 05-09-2021 02:08 PM by Albert Chan.)
Post: #31
|
|||
|
|||
RE: Puzzle - RPL and others
(05-06-2021 09:09 PM)Albert Chan Wrote: Combined, we have invariant: coprime(n,k) = coprime(n,dk) I was being stupid ... test for coprime is same as test for gcd = 1 And, for gcd ≠ 1, it is the buckets that we are after. Since test for bucket n/2 is same as matching gcd = n/2, we can remove it. Hopefully, this is my final version, by removing stuff from recurse5() / puzzle5(). Code: do (05-07-2021 02:56 AM)Albert Chan Wrote: I have confirmed n=60 has no solution ... in an hour. Updated version finished in 4½ minutes. Update1: add a simple test to quit if n is odd. Update2: unroll loops to reduce expensive mod's, this finish n=60 case in 3 minutes. The downside is n^7 ≤ 2^53 ⇒ n ≤ 190, which should be plenty enough. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)