public static function powersOfTwo(int $n) : array { $powers_of_2 = []; if ($n <= 0) { return $powers_of_2; } for ($i = 0; $i < $n; $i++) { $powers_of_2[] = 2 ** $i; } return $powers_of_2; }