Re: Product of the first 1000th Prime
- To: mathgroup at smc.vnet.net
- Subject: [mg23086] Re: [mg23026] Product of the first 1000th Prime
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sat, 15 Apr 2000 03:00:43 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
on 4/12/00 12:18 PM, Antoine Bruguier at antoine.bruguier at soon.com wrote: > Hi, > > I would like to have a text file with the product of the first 1000th > prime number. Moreover, it would like to have this numbre displayed in > hexadecimal. > > Thanks a lot, > Antoine > > You can get your number at once with BaseForm[Product[Prime[n], {n, 1, 1000}], 16] If you want to have it in a text file one thing you can do is something like this: In[1]:= temp = OpenWrite["file.txt", FormatType -> OutputForm] In[2]:= Write[temp, BaseForm[Product[Prime[n], {n, 1, 1000}], 16]] In[3]:= Close[temp] Out[3]= "file.txt" This will produce a text file file.txt in your current Directory[], containing the number you want in something resembling Mathematica's output form. I suspect this is not exactly the form you want (it will contain the character / at every line-break and a subscript 16 at the end to remind you that you have an expression in base 16) but you can easily edit it in your text editor. This seems easier than writing a program to produce just the a long line of hexadecimal digits.