MathGroup Archive 2001

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

Search the Archive

Re: Base 10 Versus Base 16 in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29186] Re: Base 10 Versus Base 16 in Mathematica
  • From: Ignacio Rodriguez <ignacio at sgirmn.pluri.ucm.es>
  • Date: Sat, 2 Jun 2001 05:54:40 -0400 (EDT)
  • Organization: UCM
  • References: <9f7kam$h08$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

1. If you want 1024 bits, your random integer should be between 2^1023 and 2^1024.
2. Use BaseForm to have an hex output.

Like: RandomPrime[d_]:=BaseForm[NextPrime[Random[Integer,{2^(d-1),2^d}]],16]

Flip at safebunch.com wrote:

> Hi All,
>
> 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.
>
> Any suggestions?  Thank you ... Wilson

--

Ignacio Rodriguez Ramirez de Arellano
Unidad de RMN
Universidad Complutense
Paseo Juan XXIII, 1
Madrid 28040, Spain

Tel. 34-91-394-3288
Fax  34-91-394-3245
e-mail: ignacio at sgirmn.pluri.ucm.es





  • Prev by Date: Re: Differential eqn. with interpolated coeficients
  • Next by Date: Re: Differential eqn. with interpolated coeficients
  • Previous by thread: Re: Base 10 Versus Base 16 in Mathematica
  • Next by thread: Re: simplex method