Re: Product of the first 1000th Prime

• To: mathgroup at smc.vnet.net
• Subject: [mg23157] Re: Product of the first 1000th Prime
• From: "DIAMOND Mark" <noname at noname.com>
• Date: Thu, 20 Apr 2000 03:21:26 -0400 (EDT)
• Organization: The University of Western Australia
• References: <8d0rd9\$54c@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```(* We do it step by step, in the knowledge that there is almost certainly a
better way! *)

(*Create a table of the first 1000 primes *)
t=Table[Prime[i], {i, 1000}];

(* Generate their product *)
p=Apply[Times, t];

(* Express the result in hexadecimal, but it will be a list containing 10,
11, 12, 13, 14, 15, 16 *)

hex=IntegerDigits[p,16];

(* Replace the digits by their appropriate character codes, and then form
the string from them *)
hexString=FromCharacterCode[
h /. {0 -> 48, 1 -> 49, 2 -> 50, 3 -> 51, 4 -> 52, 5 -> 53, 6 -> 54,
7 -> 55, 8 -> 56, 9 -> 57, 10 -> 65, 11 -> 66, 12 -> 67, 13 -> 68,
14 -> 69, 15 -> 70}];

Now you just need to write out the string by whatever method you would
normally want.

Have I just passed a homework assignment?!

Cheers,

--
Mark R Diamond
Vision Research Laboratory
The University of Western Australia
no spam email: markd at psy dot uwa dot edu dot au

```

• Prev by Date: Re: Mathematica and 3D surface.
• Next by Date: Re: Mathematica and 3D surface.
• Previous by thread: Re: Product of the first 1000th Prime
• Next by thread: Fixed Time Step for NDSolve