Preview:
vector<int> pf(int n)
{
    vector<int> v;
    for(int i=2;i<=n;++i)
    {
        while(n%i==0)
        {
            v.push_back(i);
            n/=i;
        }
    }
    return v;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter