MathGroup Archive 2001

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

Search the Archive

RE: Converting Integer to Binary and using bits

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29423] RE: [mg29391] Converting Integer to Binary and using bits
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.de>
  • Date: Tue, 19 Jun 2001 05:35:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

BaseForm[anInteger, aBase] is not what you need, since this is only a
printing form (i.e. an appearance to the eye of an unchanged object).
Possibly IntegerDigits[anInteger, 2] may give you what you need: a list of
binary digits, you can Map over or Scan through.

-- Hartmut


> -----Original Message-----
> From: Flip at safebunch.com [mailto:Flip at safebunch.com]
To: mathgroup at smc.vnet.net
> Sent: Saturday, June 16, 2001 8:48 AM
> To: mathgroup at smc.vnet.net
> Subject: [mg29423] [mg29391] Converting Integer to Binary and using bits
> 
> 
> Hi All,
> 
> I know that there is BaseForm[a,b] to convert between bases, 
> but I need some
> more functionality.
> 
> I need to be able to convert a large integer (300 - 600 
> digits) long to binary,
> know the number of digits (for a looping variable) and then 
> use each individual
> bit (from high bit to low bit).
> 
> For example, n = 11, so 11 base 10 = 1011 base 2.
> 
> The length = 4.
> 
> With the for loop, a test of each bit will be done (in this 
> example 1, 0, 1, 1).
> 
> Can someone give any direction on how to do this?  Thanks ... Flip
> 
> 



  • Prev by Date: Re: Reading, Modifying, and Writing a file with data with quotation marks
  • Next by Date: Re: How to produce "thick" lines in 3D?
  • Previous by thread: Re: Converting Integer to Binary and using bits
  • Next by thread: roots