Puzzle  RPL and others

05092021, 01:21 AM
Post: #33




RE: Puzzle  RPL and others
(05072021 04:17 PM)3298 Wrote: On the laptop, 60 is still rescued by the large number of small buckets and processes in about a second. The idea of getting buckets from gcd(2n,d) does not have much to back it up. Buckets from gcd(n, d) does, based on successive removal from set of digits {1 to n1} This is how we get the nonbuckets. (removal of all multiples, i.e. coprime to n) Mod4 rule is also easy to show. We only need 2 digits. If n = 4k: d3*(4k) + d4 = 0 (mod 4) d4 = 0 (mod 4) → d4 = d8 = d12 = ... = 0 (mod 4) → d2 = d6 = d10 = ... = 2 (mod 4) If n = 4k+2: d3*(4k+2) + d4 = 0 (mod 4) 2*d3 + d4 = 0 (mod 4) d4/2 = d3 = 1 (mod 2) d4 = 2 (mod 4) → d4 = d8 = d12 = ... = 2 (mod 4) → d2 = d6 = d10 = ... = 0 (mod 4) This generalized to invariant (even n, even k): n + k + d_{k} ≡ 0 (mod 4)  I tried to see the difference of gcd(n,d) vs gcd(2n,d), and this affect more than 1 bucket. Code: from gmpy2 import gcd >>> bucket(60) 1 [1, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59] 2 [2, 14, 22, 26, 34, 38, 46, 58] 3 [3, 9, 21, 27, 33, 39, 51, 57] 4 [4, 8, 16, 28, 32, 44, 52, 56] 5 [5, 25, 35, 55] 6 [6, 18, 42, 54] 10 [10, 50] 12 [12, 24, 36, 48] 15 [15, 45] 20 [20, 40] 30 [30] >>> bucket(60,2) 1 [1, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59] 2 [2, 14, 22, 26, 34, 38, 46, 58] 3 [3, 9, 21, 27, 33, 39, 51, 57] 4 [4, 28, 44, 52] 5 [5, 25, 35, 55] 6 [6, 18, 42, 54] 8 [8, 16, 32, 56] 10 [10, 50] 12 [12, 36] 15 [15, 45] 20 [20] 24 [24, 48] 30 [30] 40 [40] We have 3 splits, how to apply the rules ? Bucket 4 had splitted to 4 + 8 Bucket 12 had splitted to 12 + 24 Bucket 20 splitted to 20 + 40 And more importantly, is it even correct to "swap" buckets ? You might need to show this is always true, before adding it to the code ... 

« Next Oldest  Next Newest »

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