Re: Re: All Factors of a number
- To: mathgroup at smc.vnet.net
- Subject: [mg53092] Re: [mg53059] Re: All Factors of a number
- From: DrBob <drbob at bigfoot.com>
- Date: Thu, 23 Dec 2004 07:58:33 -0500 (EST)
- References: <200412201134.GAA02639@smc.vnet.net> <200412211019.FAA17308@smc.vnet.net> <200412220952.EAA04441@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
I'm not sure what you mean by a "double trunk", but there are Mersennes with two factors at n=5, 9, 12, 13, 19, 23... and others. Either I'm misunderstanding you, or numbers are running together on your screen. Timing on my wife's 2GHz dual-G5 is 818.86 seconds... not a huge improvement over your G4. It's only 42% faster despite a 60% faster clock speed! Bobby On Wed, 22 Dec 2004 04:52:49 -0500 (EST), János <janos.lobb at yale.edu> wrote: > Bobby, > > Nice !! > > You must have a minimum 17 inch monitor as I see :) > > With the best, > > János > P.S: G4 1.25G Total Time: 1161.98 Second. Not bad for a Mac ! I > expected 1277.44 Second. Here is a naive question for you. Will you > ever have a "trunk" of length 2, so this tree can stand on it ? If I am > counting from the bottom up, the first single trunk is at n=31, there > is no double trunk, the only triple is at n={6,7,8} and well the top > with length 4 is the top. I skipped lectures when number theory was > taught, - which might says, there will be never a double "trunk", may > be not even a single one with n > 54 -, so I am not a good candidate to > answer it :) > > On Dec 21, 2004, at 5:19 AM, DrBob wrote: > > > >> FactorInteger does this already. >> >> Just for grins, here's code to list factorizations of Mersenne numbers >> in Xmas tree format. >> >> toPowers = {{a_Integer, 1} -> HoldForm[a], {a_Integer, b_Integer} -> >> HoldForm[a]^HoldForm[b], >> List -> Times}; >> toStars = StringReplace[ToString[#1 /. toPowers], " " -> " * "] & ; >> n = 1; >> {totalTime, results} = >> Timing[First[Last[Reap[While[n <= 54, p = Prime[n]; >> Sow[Timing[{n, p, FactorInteger[2^p - 1]}]]; n++]]]]] /. >> {(s_)*Second, {n_, p_, f_}} :> {n, p, s, toStars[f]}; >> TableForm[results, TableAlignments -> {Center, Center, Right}, >> TableHeadings -> {None, {"n", "p = Prime[n]"*1, Seconds, "Factors of >> 2^p-1"}}] >> Print["Total Time: ", totalTime] >> >> That took 499 seconds on my AMD 3200+ machine, so reduce 54 to a >> smaller number if you're using a slower machine or don't have the >> patience. Of those 499 seconds, 125 were used for the 54th Mersenne, >> 201 for the 47th Mersenne, and 63 for the 50th. The rest go pretty >> fast, so reducing 54 to 46 will work well. >> >> Bobby >> >> On Mon, 20 Dec 2004 06:34:49 -0500 (EST), Ulrich Sondermann >> <usondermann at earthlink.net> wrote: >> >> >>> Following is a test code that I am trying to get down to a set of >>> instructions that will allways put all of the factors of a number in >>> a table >>> or list. >>> bt contains all of the factors if I multiply each list entry, however >>> I >>> cannot accomplish that with a single line, as an example I have >>> broken into >>> the three lists needed for this example. The results of each >>> "Times@@" is >>> what I am after all placed into one table. All of my attempts have >>> proved >>> disasterous, I am new to Mathematica and could do this with nested >>> loops in >>> any programming language, but this has me stumped. >>> Thanx! >>> >>> <<DiscreteMath`Combinatorica` >>> bt=Table[KSubsets[{1,2,3,5},a],{a,3}] >>> {{{1},{2},{3},{5}},{{1,2},{1,3},{1,5},{2,3},{2,5},{3,5}},{{1,2,3}, >>> {1,2,5},{1 >>> ,3,5},{2,3,5}}} >>> bt1=bt[[1,All]] >>> {{1},{2},{3},{5}} >>> Table[Times@@bt1[[a]],{a,4}] >>> {1,2,3,5} >>> bt2=bt[[2,All]] >>> {{1,2},{1,3},{1,5},{2,3},{2,5},{3,5}} >>> Table[Times@@bt2[[a]],{a,6}] >>> {2,3,5,6,10,15} >>> bt3=bt[[3,All]] >>> {{1,2,3},{1,2,5},{1,3,5},{2,3,5}} >>> Table[Times@@bt3[[a]],{a,4}] >>> {6,10,15,30} >>> >>> >>> >>> >>> >> -- DrBob at bigfoot.com >> www.eclecticdreams.net >> > > > > -- DrBob at bigfoot.com www.eclecticdreams.net
- References:
- All Factors of a number
- From: "Ulrich Sondermann" <usondermann@earthlink.net>
- Re: All Factors of a number
- From: DrBob <drbob@bigfoot.com>
- Re: All Factors of a number
- From: János <janos.lobb@yale.edu>
- All Factors of a number