Re: Base 10 Versus Base 16 in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg29183] Re: [mg29176] Base 10 Versus Base 16 in Mathematica
- From: BobHanlon at aol.com
- Date: Sat, 2 Jun 2001 05:54:37 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/6/1 4:21:26 AM, Flip at safebunch.com writes:
>is it possible to modify the following function to allow the user to select
>the
>number of bits as opposed to the number of digits?
>
>In[1]:=
>Needs["NumberTheory`NumberTheoryFunctions`"]
>
>In[2]:=
>RandomPrime[d_] := NextPrime[Random[Integer, {10^(d - 1), 10^d}]]
>
>The operator would select RandomPrime[1024] and this would produce a
hexdecimal
>output with 1024 bits displayed as a hex number.
>
Needs["NumberTheory`NumberTheoryFunctions`"];
RandomPrime[d_] := BaseForm[NextPrime[Random[Integer, {2^(d - 1), 2^d}]], 8];
RandomPrime[3*10]
Bob Hanlon
Chantilly, VA USA