RE Bin <-> Decimal conversion
- To: MATHGROUP at CHRISTENSEN.Cybernetics.NET
- Subject: [mg401] RE [mg395] Bin <-> Decimal conversion
- From: p.kent at ic.ac.uk
- Date: Thu, 12 Jan 95 16:15:47 GMT
>... 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
----------------------------------+----------------------------