Ask Your Question

Revision history [back]

To get the exponent in a number factor use valuation:

sage: valuation(8,2)
3
sage: valuation(65536,2)
16
sage: e=[None]*8
sage: valuation(len(e),2)
3

To get the numerical value of a symbolic expression like log(8)/log(2) use n():

sage: log(8)/log(2)
log(8)/log(2)
sage: N(log(8)/log(2))
3.00000000000000

This will be floating point however so better use the first method.