79278634

Date: 2024-12-13 14:28:25
Score: 2.5
Natty:
Report link

import numpy as np

#A: A random number which may not be a power of two. #B: The next power of two after A.

B=int(2**np.ceil(np.log2(A)))

if np.log2(B)-1==np.log2(A): B=A

Reasons:
  • Low length (1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Ali Ozcebe