On Tuesday 23 August 2011, Tom Boothby wrote:
> Treat it as a binary number:
> 
> s = ''.join(str(i) for i in A)
> ZZ(s, base=2)

sage: Z((1,0),2)
1
sage: Z((1,1),2)
3
 
> On Tue, Aug 23, 2011 at 12:08 PM, Santanu Sarkar
> 
> <[email protected]> wrote:
> > Let A=(1,1,0,0,0,1) be an binary array. How efficiently can we calculate
> > the corresponding integer?
> > 
> > --
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> > http://groups.google.com/group/sage-support
> > URL: http://www.sagemath.org

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: [email protected]

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to