How to use this calculator
Find the greatest integer power of two not exceeding a numeric input n of at least 1.
- Enter Positive integer n. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
How Largest power of two calculator works
Find the greatest integer power of two not exceeding a numeric input n of at least 1.
Inputs and units
- Positive integer n: Enter n≥1. Decimal inputs are accepted; flooring them does not change the greatest power of two below n.
Formula and method
k=floor(log₂ n), and result=2ᵏ. The comparison is inclusive, so an input that is already a power of two returns itself.
Worked example
For n=100.5, 2⁶=64≤100.5 while 2⁷=128>100.5; the answer is 64. Flooring 100.5 to 100 gives the same power.
Interpreting the result
The result is the lower power-of-two boundary containing n: 64≤100.5<128.
Assumptions and limits
For n≥1, decimal inputs give the same result as their integer floor because floor(log₂ n) changes only at powers of two. Values below 1 have no positive power-of-two result; very large inputs are limited by the browser’s numeric range.
Sources and method
- For positive n, floor(log₂ n) is the exponent of the greatest power of two not exceeding n. Ohio University discrete mathematics notes
Frequently asked questions
What happens when n is 64?
It returns 64 because the input is already a power of two.
Can n include a decimal?
Yes. For n≥1, decimals are accepted and cannot change the greatest power selected between adjacent powers of two.
How do I use the Largest power of two calculator?
Enter Positive integer n. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Largest power of two?
For n=100.5, 2⁶=64≤100.5 while 2⁷=128>100.5; the answer is 64. Flooring 100.5 to 100 gives the same power.
What does the Largest power of two calculator calculate?
Find the greatest integer power of two not exceeding a numeric input n of at least 1.