mathtools.remove_powers_of_two

abjad.tools.mathtools.remove_powers_of_two(n)

Remove powers of 2 from the factors of positive integer n.

abjad> for n in range(10, 100, 10):
...     print '\t%s\t%s' % (n, mathtools.remove_powers_of_two(n))
... 
   10 5
   20 5
   30 15
   40 5
   50 25
   60 15
   70 35
   80 5
   90 45

Raise TypeError on noninteger n:

abjad> mathtools.remove_powers_of_two(7.5)
TypeError

Raise ValueError on nonpositive n:

abjad> mathtools.remove_powers_of_two(-1)
ValueError

Previous topic

mathtools.partition_integer_into_units

Next topic

mathtools.sign

This Page