We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
find the number of the primitove roots.
We know that any prime p has ϕ(p−1) primitive roots. We also know that the prime power decomposition of p - 1 can be written as: p−1=p1^(e1),p2^(e2)..., and we then know that ϕ(p−1)=p1^(e1−1)(p1−1)p2^(e2−1)(p2−1)...pk^(ek−1)*(pk−1)
n--;for(autofa:fact)n=n/fa*(fa-1);cout<<n<<endl;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Primitive Problem
You are viewing a single comment's thread. Return to all comments →
algo: 1. find all the unique prime factor of the n-1.