MathGroup Archive 1995

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

Search the Archive

RE Bin <-> Decimal conversion


>... I am still looking for an efficient way to perform ToBin.

My colleague Phil Ramsden (p.ramsden at ic.ac.uk) suggests:

ToBin[0] = {}

ToBin[n_] := Append[ToBin[(n-#)/2],#]&[Mod[n,2]]


----------------------------------+----------------------------
 Dr Phillip Kent                  | Email: p.kent at ic.ac.uk 
 Transitional Mathematics Project | 
 Mathematics Department           | Tel: +44 (0)71 59 48503 
 Imperial College                 | Fax: +44 (0)71 59 48517   
 180 Queen's Gate                 |   
 London SW7 2BZ                   | Project World-Wide-Web at: 
 United Kingdom.                  | http://othello.ma.ic.ac.uk
----------------------------------+----------------------------



  • Prev by Date: Re: Problem with Contexts
  • Next by Date: Re: Bin <-> Decimal conversion
  • Previous by thread: mma2html program
  • Next by thread: Student column of Mathematica in Ed.