Returns the least power of two that's greater than or equal to n
.
Examples:
Nat.nextPowerOfTwo 0 = 1
Nat.nextPowerOfTwo 1 = 1
Nat.nextPowerOfTwo 2 = 2
Nat.nextPowerOfTwo 3 = 4
Nat.nextPowerOfTwo 5 = 8
Equations
Instances For
@[reducible, inline, deprecated Nat.isPowerOfTwo_one (since := "2025-03-18")]
Equations
Instances For
theorem
Nat.isPowerOfTwo_mul_two_of_isPowerOfTwo
{n : Nat}
(h : n.isPowerOfTwo)
:
(n * 2).isPowerOfTwo
@[reducible, inline, deprecated Nat.isPowerOfTwo_mul_two_of_isPowerOfTwo (since := "2025-04-04")]