Here is a brute force version. I simply compute the divisors and then
try multiplying size of them together. If the result is the original
number, I keep it. For the small values of n and size that I deal
with this is fast enough, but it would be nice to have something that
scales well (algorit
> Well, if what you mean by factor tree is something like
> http://thesaurus.maths.org/mmkb/media/png/FactorTree.png , then I think
> what Brian is asking for a bit more complicated. If I understand
> correctly, he's asking for the set of all the sets of numbers (prime or
> composite) whose produ
> Quick important question: How big is the positive integer n?
> I.e., is factoring integers an important difficulty?
In what I am doing n is the number of processors an array is
distributed over. Thus, n scales with the number of dollars a user
has spend on their cluster :) This will tend to k
> Sorry, I missed the post where you clarified that you weren't just
> looking for factor pairs. There's got to be a way to extend this idea
> to make it more arbitrary, but I haven't figured it out yet. At least
> we know there's going to be an upper bound on the number of elements you
> have i
John Cremona wrote:
> Jacob, are you re-inventing factr trees by any chance? (Try googling
> "factor tree" to see what they are).
>
Well, if what you mean by factor tree is something like
http://thesaurus.maths.org/mmkb/media/png/FactorTree.png , then I think
what Brian is asking for a bit m
On Wed, 23 Jan 2008, Jacob Mitchell wrote:
>
>
>
> Jacob Mitchell wrote:
>>
>> John Cremona wrote:
>>
>>> Is a "multiplcative partition" just a factorization?
>>>
>>> How about this:
>>>
>>> sage: def mp(n):
>>> : return [(d,n//d) for d in n.divisors()]
>>> :
>>> sage: mp(12)
>>> [
Jacob, are you re-inventing factr trees by any chance? (Try googling
"factor tree" to see what they are).
John
On 23/01/2008, Jacob Mitchell <[EMAIL PROTECTED]> wrote:
>
>
>
> Jacob Mitchell wrote:
> >
> > John Cremona wrote:
> >
> >> Is a "multiplcative partition" just a factorization?
> >>
>
Jacob Mitchell wrote:
>
> John Cremona wrote:
>
>> Is a "multiplcative partition" just a factorization?
>>
>> How about this:
>>
>> sage: def mp(n):
>> : return [(d,n//d) for d in n.divisors()]
>> :
>> sage: mp(12)
>> [(1, 12), (2, 6), (3, 4), (4, 3), (6, 2), (12, 1)]
>>
>> where
Sorry to reply to myself, but I just realized that I haven't done
support for duplicates in OrderedSetPartitions so ignore my previous
post :)
--Mike
On Jan 23, 2008 11:47 AM, Mike Hansen <[EMAIL PROTECTED]> wrote:
> > I have a simple function that (like your example) can compute things
> > for
> I have a simple function that (like your example) can compute things
> for size=2. I am trying to figure out how to generalize to arbitrary
> size.
Here's an example of how you can do it in Sage:
sage: a = factor(2*3*3*5*7*13);a
2 * 3^2 * 5 * 7 * 13
sage: b = sum([ [f]*mult for f,mult in a],
John Cremona wrote:
> Is a "multiplcative partition" just a factorization?
>
> How about this:
>
> sage: def mp(n):
> : return [(d,n//d) for d in n.divisors()]
> :
> sage: mp(12)
> [(1, 12), (2, 6), (3, 4), (4, 3), (6, 2), (12, 1)]
>
> where of course you could eliminate the cases d=
The I think that the keywords you need are "factor tree" or
"factorization tree".
John
On 23/01/2008, Brian Granger <[EMAIL PROTECTED]> wrote:
>
> On Jan 23, 2008 11:52 AM, John Cremona <[EMAIL PROTECTED]> wrote:
> >
> > Is a "multiplcative partition" just a factorization?
>
> Yep
>
> > How abou
On Jan 23, 2008 11:52 AM, John Cremona <[EMAIL PROTECTED]> wrote:
>
> Is a "multiplcative partition" just a factorization?
Yep
> How about this:
>
> sage: def mp(n):
> : return [(d,n//d) for d in n.divisors()]
> :
> sage: mp(12)
> [(1, 12), (2, 6), (3, 4), (4, 3), (6, 2), (12, 1)]
T
On Jan 23, 2008 10:33 AM, Brian Granger <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am working on a parallel/distributed array library for
> python/ipython. For this library I need to be able to compute the
> multiplicative partitions of positive integers:
>
> 12 => (2,6), (3,4)
Quick important que
Is a "multiplcative partition" just a factorization?
How about this:
sage: def mp(n):
: return [(d,n//d) for d in n.divisors()]
:
sage: mp(12)
[(1, 12), (2, 6), (3, 4), (4, 3), (6, 2), (12, 1)]
where of course you could eliminate the cases d=1, d=n and so on.
John
On 23/01/2008, B
15 matches
Mail list logo