Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Pretty output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35157] Re: [mg35149] Pretty output
  • From: BobHanlon at aol.com
  • Date: Thu, 27 Jun 2002 00:23:22 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 6/26/02 1:37:12 AM, rgwv at kspaint.com writes:

>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?

Your Print output is wider than your window and is being wrapped.
Use the following:

s[n_] := Evaluate[Sum[x^i,{i,0,2^n}]];

(t=Table[Factor[s[n],Modulus->2],{n,10}])//ColumnForm

If[Head[#]===Times,Length[#],1]& /@ t


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Mathematica code for the Anderson-Darling goodness of fit test
  • Next by Date: Assigning to a sublist
  • Previous by thread: Re: Pretty output
  • Next by thread: RE: Pretty output