Divisors
- To: mathgroup at smc.vnet.net
- Subject: [mg24272] Divisors
- From: hahaj at home.com (Hans Havermann)
- Date: Wed, 5 Jul 2000 23:10:56 -0400 (EDT)
- Organization: Rarebit Dreams
- Sender: owner-wri-mathgroup at wolfram.com
I need a re-formulated "divisors" function that works, *not* on Integers, but on the *list of factors* that one gets when one applies FactorInteger to a number. That way I can still get the divisors of a number whose factorization is difficult, but nonetheless known. I have a rough working model of such a function but it relies on the function Subsets found in DiscreteMath`Combinatorica` (see below) and I don't have enough RAM to apply Subsets to lists larger than 20 elements. Unfortunately, I need to find the divisors of numbers whose factorization comprises as many as 40 elements. Can anyone provide a programming solution? -- << DiscreteMath`Combinatorica` fac = First[Transpose[FactorInteger[2*3*3*11*11*11*13]]]; pow = Last[Transpose[FactorInteger[2*3*3*11*11*11*13]]]; expfac = {}; Do[ Do[expfac = Append[expfac, fac[[i]]], {j, 1, pow[[i]]}], {i, 1, Length[pow]}]; expfac {2, 3, 3, 11, 11, 11, 13} div = ReplacePart[Union[Subsets[expfac]], {1}, 1] {{1}, {2}, {3}, {11}, {13}, {2, 3}, {2, 11}, {2, 13}, {3, 3}, {3, 11}, {3, 13}, {11, 11}, {11, 13}, {2, 3, 3}, {2, 3, 11}, {2, 3, 13}, {2, 11, 11}, {2, 11, 13}, {3, 3, 11}, {3, 3, 13}, {3, 11, 11}, {3, 11, 13}, {11, 11, 11}, {11, 11, 13}, {2, 3, 3, 11}, {2, 3, 3, 13}, {2, 3, 11, 11}, {2, 3, 11, 13}, {2, 11, 11, 11}, {2, 11, 11, 13}, {3, 3, 11, 11}, {3, 3, 11, 13}, {3, 11, 11, 11}, {3, 11, 11, 13}, {11, 11, 11, 13}, {2, 3, 3, 11, 11}, {2, 3, 3, 11, 13}, {2, 3, 11, 11, 11}, {2, 3, 11, 11, 13}, {2, 11, 11, 11, 13}, {3, 3, 11, 11, 11}, {3, 3, 11, 11, 13}, {3, 11, 11, 11, 13}, {2, 3, 3, 11, 11, 11}, {2, 3, 3, 11, 11, 13}, {2, 3, 11, 11, 11, 13}, {3, 3, 11, 11, 11, 13}, {2, 3, 3, 11, 11, 11, 13}} Sort[Table[Apply[Times, div[[i]]], {i, 1, Length[div]}]] {1, 2, 3, 6, 9, 11, 13, 18, 22, 26, 33, 39, 66, 78, 99, 117, 121, 143, 198, 234, 242, 286, 363, 429, 726, 858, 1089, 1287, 1331, 1573, 2178, 2574, 2662, 3146, 3993, 4719, 7986, 9438, 11979, 14157, 17303, 23958, 28314, 34606, 51909, 103818, 155727, 311454} Divisors[2*3*3*11*11*11*13] - % {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
- Follow-Ups:
- Re: Divisors
- From: Arnold <arnoldk@gauss.cam.wits.ac.za>
- Re: Divisors