MathPHP\Sequence\Basic::cubicNumber PHP Method

cubicNumber() public static method

n³ Example: n = 5 Sequence: 0³, 1³, 2³, 3³, 4³ Sequence: 0, 1, 8, 27, 64 Array index: 0, 1, 2, 3, 4
public static cubicNumber ( integer $n ) : array
$n integer How many numbers in the sequence
return array Indexed from 0 (indexes are the base number which is raised to the power of 3)
    public static function cubicNumber(int $n) : array
    {
        $cubes = [];
        if ($n <= 0) {
            return $cubes;
        }
        for ($i = 0; $i < $n; $i++) {
            $cubes[] = $i ** 3;
        }
        return $cubes;
    }