
    #include <vector>
    #include <iostream>

    // Here is your recursive function!
    // Ok ok, that's cheating...
    unsigned int fact(unsigned int n)
    {
        if(n == 0) return 1;
        else return n * fact(n - 1);
    }

    unsigned int binom(unsigned int n, unsigned k)
    {
        // Not very optimized (useless multiplications)
        // But that's not really a problem: the number will overflow
        // way earlier than you will notice any performance problem...
        return fact(n) / (fact(k) * fact(n - k));
    }

    std::vector<unsigned int> pascal(unsigned n)
    {
        std::vector<unsigned int> res;
        for(unsigned int k = 0; k <= n; k++)
            res.push_back(binom(n,k));
        return res;
    }

    std::ostream& operator<<(std::ostream& out, const std::vector<unsigned int>& v)
    {
        for(unsigned int t = 0; t < v.size(); t++)
            out << v[t] << " ";
        return out;
    }

    int main()
    {
        for(unsigned int t = 0; t < 6; t++)
            std::cout << pascal(t) << "\n";
    }

