Power of 4

Power of 4 generator

Power of 4 Validator

Problem Statement

Given a positive integer, determine whether it is a power of 4. A power of 4 is a number that can be expressed as 4^n where n ≥ 0.

For example: 1 (4^0), 4 (4^1), 16 (4^2), 64 (4^3), 256 (4^4), etc.

Constraints

  • Input: positive integer (greater than 0)
  • Powers of 4: 1, 4, 16, 64, 256, 65536, ...
  • Efficiently determine power of 4 using bit manipulation

Loading the interactive workspace...