RE: Pretty output
- To: mathgroup at smc.vnet.net
- Subject: [mg35152] RE: [mg35149] Pretty output
- From: "DrBob" <majort at cox-internet.com>
- Date: Thu, 27 Jun 2002 00:23:13 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
Here's a faster computation, with factor counts: s = 1 + x; Do[s += Sum[x^i, {i, 2^(n - 1) + 1, 2^n}]; Print[f = Factor[s, Modulus -> 2]]; Print[If[Head[f] === Times, Length[f], 1]], {n, 0, 5}] As for the output -- why were you using ToString in the first place? You're seeing exponents on one line and the x's on the next, but eventually the lines get too long, so you see (for instance) three lines of exponents, then three lines of x's. The result of ToString is a single String, but with "\n" in the middle of it, exponents at the beginning, etc. UGLY. So... again... why use ToString? Bobby Treat -----Original Message----- From: Robert G. Wilson v [mailto:rgwv at kspaint.com] To: mathgroup at smc.vnet.net Subject: [mg35152] [mg35149] Pretty output Help please. I put in the following Mathematica code: Do[s = Sum[x^i, {i, 0, 2^n}]; Print[ ToString[ Factor[ s, Modulus -> 2]]], {n, 1, 10}] The output was fairly straight forward until n=6 and beyond. What I am seeing is: " 2 3 4 4 5 6 7 8 12 2 5 6 7 10 12 2 3 4 6 8 9 \ 10 12 3 5 6 7 9 11 12 2 3 4 5 6 7 8 9 10 11 12\n(1 + x \ + x + x + x ) (1 + x + x + x + x + x + x ) (1 + x + x + x + x + x + x ) (1 + x + x + x + x + x + x + x + x \ ) (1 + x + x + x + x + x + x + x + x ) (1 + x + x + x + x + x + x + x + x + x + x + x + x )" What is the deal here? Also what is the easiest way to count the number of factors? Thank you for any assistance in advance. Sincerely yours, Robert G. Wilson, V