The Print statement

We have already seen a few examples of the use of the Print statement. As Mathematica
prints the result of most calculations, it is usually not necessary to use the Print statement, except
to format the output for improved readability. There are some features of the
Print statement that should be kept in mind. The first is that Print does not leave any
space between the values of different arguments. The amount of space for proper
display has to be specified by you. For example,

In[67]:=

  Print[ a,b,c]

  abc



;[o]
abc

To get the appropriate space, specify it in the statement.

In[68]:=

  Print[ a, " ", b, " ", c]

  a b c



;[o]
a b c

Additional characters that are useful are "\t" for the tab and "\n" for the end of line. Unlike
C, Mathematica always places an end of line character at the end of a Print statement.

In[69]:=

  Do[ Print[ "First prime above ", 10^n, " is ",
                firstprimeabove[ 10^n]],
       {n, 1, 10}]

  First prime above 10 is 11
First prime above 100 is 101
First prime above 1000 is 1009
First prime above 10000 is 10007
First prime above 100000 is 100003
First prime above 1000000 is 1000003
First prime above 10000000 is 10000019
First prime above 100000000 is 100000007
First prime above 1000000000 is 1000000007
First prime above 10000000000 is 10000000019



;[o]
First prime above 10 is 11
First prime above 100 is 101
First prime above 1000 is 1009
First prime above 10000 is 10007
First prime above 100000 is 100003
First prime above 1000000 is 1000003
First prime above 10000000 is 10000019
First prime above 100000000 is 100000007
First prime above 1000000000 is 1000000007
First prime above 10000000000 is 10000000019

Up to Tutorial