Number theory course : youtube CodeNCode(2 Aug 2020 : Practice Problem added)

this course is really helpful it helped me with many number theory concepts thank u

you’re welcome man

2 Likes

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

@waqar_ahmad224
Please make a tutorial video on digit dp.

I was thinking the same

1 Like

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 :slight_smile: .

1 May 2020 : 1 New Video added.
L20 : Euler’s Totient Function & GCD Sum

3 May 2020 : New Editorial Added

E002 : Totient Extreme | SPOJ | Number Theory

5 May 2020 : 1 new video added
L21 : ETF & GCD Sum Part 2

5 May 2020 : 1 video editorial added
E003 : Count The Sum (Medium) : HackerRank

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?