(n)
| 39 | # calculating the power of two |
| 40 | @staticmethod |
| 41 | def calculate(n): |
| 42 | digits = [1] |
| 43 | |
| 44 | # little performance improvement |
| 45 | for k in [3, 2]: |
| 46 | if n > 2**k: |
| 47 | PowerOfTwo.calculateDigits(digits, n // k, 2**k) |
| 48 | n %= k |
| 49 | |
| 50 | if n > 0: |
| 51 | PowerOfTwo.calculateDigits(digits, n, 2) |
| 52 | digits.reverse() |
| 53 | return digits |
| 54 | |
| 55 | @staticmethod |
| 56 | def dump(digits, digitsPerRow = 50): |
no test coverage detected