Jump to content

[C++]Suma puterilor din descompunerea in factori primi


AIM Katzuno Valoare
 Share

Recommended Posts

Nivel: Incepator

 

 

#include <iostream>
using namespace std;
 
int main() {
int n, d = 2, s = 0, p;
cin >> n;
while (n > 1)   {
p = 0;
while (n%d == 0) {
n /= d;
p++;
}
s += p;
d++;
}
cout << s;
return 0;
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.