this course is really helpful it helped me with many number theory concepts thank u
youâre welcome man
30 April 2020 : 2 new lecture added.
L18 : Calculating Euler Phi Function from 1 to N in O(Nlog(logN)) Time
E001 : Eulerâs Totient Function | SPOJ | Number Theory
I was thinking the same
can you add Möbius inversion to your course plzz?
currently I am teaching Eulerâs Totient Function.
Hopefully after that I will teach mobius inversion as well
Hey can you please how to find phi_Inverse(x) as it is solution of question this. I got the solution is phi_inverse(x) but dont know how to calculate it for given constraint.It will of great help.
I will make video lecture on this
for now you can read this : number theory - inversion of the Euler totient function - Mathematics Stack Exchange
this answer is really great
//if we want to calculate all divisior of a number i sqrt(n)
#include<bits/stdc++.h>
using namespace std;
int divisior(int n)
{
int res=n;
for(int i=2;i<=sqrt(n);i++)
{
if(n%i==0)
{
res=res*(i-1);
res=res/i;
while(n%i==0)
n=n/i;
}
}
if(n>1)
{
res=res*(n-1);
res=res/n;
}
return res;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(tâ>0)
{
int n;
cin>>n;
int l=divisior(n);
cout<<l<<endl;
}
}
why spoj give wrong answer EFT problem
this should be a compilation error
it should be
while(t--)
or
while(t-->0)
and declare res to be long long int .
WA is because of integer overflow in res
Thanks
youâre welcome .
is queries a fancy way of saying test cases or they are different from each other ???
I am hard time understanding what you are referring here.
will you elaborate a bit?