Factoring[8 616 460 799] like 100 years ago
|
09-08-2022, 06:31 PM
(This post was last modified: 09-12-2022 04:59 PM by Albert Chan.)
Post: #12
|
|||
|
|||
RE: Factoring[8 616 460 799] like 100 years ago
Another way, we can avoid mod screening tests and later square confirmation.
see Algorithm FnPS, https://thesai.org/Downloads/Volume11No1...rithms.pdf Let r = (x^2 - y^2 - n)/2 If r < 0, we update r, with new x = x+1 If r > 0, we update r, with new y = y+1 Δ(x^2)/2 = x+1/2 Code: function fermat(n) -- assumed odd n lua> fermat(8616460799) 92825 141 -27.5 92826 454 -319.5 92827 626 -373 92828 760 -407.5 ... 92877 3111 -995.5 92878 3141 -1898 92879 3170 -529 92880 3199 0 89681 96079 Update 1: For positive n, x-y ≥ 1 --> x ≥ y+1 This leads to slightly faster version. Code: function fermat(n) -- assumed odd n Update 2: mod 4: odd^2 ≡ 1, even^2 ≡ 0 odd x, even y: n = x^2 - y^2 ≡ 1 - 0 ≡ 1 (mod 4) even x, odd y: n = x^2 - y^2 ≡ 0 - 1 ≡ 3 (mod 4) With parity of (x,y) maintained, z = ((x+y)*(x-y)-n)/4 is integer Code: function fermat(n) -- assumed odd n lua> fermat(8616460799) 92826 455 -387 92828 761 -584 92830 975 -631 92832 1149 -194 ... 92874 3021 -1841 92876 3081 -496 92878 3141 -949 92880 3199 0 89681 96079 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)