Re: Pretty output

*To*: mathgroup at smc.vnet.net*Subject*: [mg35165] [mg35163] Re: [mg35149] Pretty output*From*: Tomas Garza <tgarza01 at prodigy.net.mx>*Date*: Fri, 28 Jun 2002 02:30:49 -0400 (EDT)*References*: <200206260509.BAA05233@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

I see nothing wrong with the first part of your problem. If you write In[1]:= Clear[s]; s[n_] := Sum[x^i, {i, 0, 2^n}]; and evaluate the factoring for, say s[7], you get the right answer: In[2]:= a = Factor[s[7], Modulus -> 2] Out[2]= (1 + x + x^2)*(1 + x^5 + x^7 + x^9 + x^14)* (1 + x^4 + x^6 + x^7 + x^8 + x^10 + x^14)* (1 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10 + x^11 + x^14)*(1 + x^2 + x^5 + x^6 + x^7 + x^8 + x^9 + x^12 + x^14)*(1 + x^2 + x^4 + x^7 + x^10 + x^12 + x^14)*(1 + x + x^4 + x^6 + x^7 + x^8 + x^10 + x^13 + x^14)*(1 + x + x^3 + x^7 + x^11 + x^13 + x^14)* (1 + x + x^2 + x^5 + x^6 + x^7 + x^8 + x^9 + x^12 + x^13 + x^14)*(1 + x + x^2 + x^3 + x^4 + x^5 + x^7 + x^9 + x^10 + x^11 + x^12 + x^13 + x^14) (this is what you read when converting Cell to Input Form; normally you would have it in Standard Form, which would then display the exponents very nicely). The problem arises when you apply ToString to the last output: what do you expect to get, other than a bunch of numbers, corresponding to the exponents, and sums of apparently isolated x's? If you modify the window size, the result changes too, since each exponent is trying to find its base according to the amount and dimensions of display space available. I don't see why you want to deal with that string. Now, the number of factors comes easily from In[3]:= Count[a,(x_)] Out[3]= 10 Tomas Garza Mexico City ----- Original Message ----- From: "Robert G. Wilson v" <rgwv at kspaint.com> To: mathgroup at smc.vnet.net Subject: [mg35165] [mg35163] [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 >

**References**:**Pretty output***From:*"Robert G. Wilson v" <rgwv@kspaint.com>