Ruud H.G. van Tol on Wed, 29 Dec 2021 14:12:23 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
factor(x+1) |
I think I am looking for a decent data-structure to store a factor(x+1) tree. But if you see a different angle on it, don't hesitate. I'm considering Vec-of-Vec, to mean something like (vecprod(v)-1). Example: - - - - N=9781262575275081247; \ apply(Vec,Vec(factor(N+1)~)) [ [2, 5] , [19, 1] , [1987, 1] , [1038209, 1] , [7798457, 1] ] Manual transformations: (so beware of tpyos) [ [2, 5] \\ 2^5 , [[ [2,2], 5 ]] \\ (2^2*5 -1) , [[ [2,2], 7, 71 ]] \\ (2^2*7*71 -1) , [[ 2, 3, 5, 34607 ]] \\ (2*3*5*34607 -1) , [[ 2, 3, 1299743 ]] \\ (2*3*1299743 -1) ] [ [2, 5] \\ 2^5 , [[ [2,2], [[2,3]] ]] \\ 2^2*(2*3-1) , [[ [2,2], [[ [2,3] ]], [[ [2,3],[3,2] ]] ]] \\ 2^2*(2^3-1)*(2^3*3^2-1) , [[ 2,3, [[2,3]], [[ [2,4], 3, 7, 103 ]] ]] \\ 2*3*(2*3-1)*(2^4*3*7*103-1) , [[ 2,3, [[ [2,5], [3^2], 4513 ]] \\ 2*3*(2^5*3^2*4513-1) ] 103 -> 2^3*13 -> 2^3*(2*7-1) -> 2^3*(2*(2^3-1)-1) 4513 -> 2*37*61 -> 2*(2*19-1)*(2*31-1) -> 2*(2^2*5-1)*(2*(2^5-1)-1) -> 2*(2^2*(2*3-1)-1)*(2*(2^5-1)-1) - - - - -- Ruud