COUNTING DIVISORS

HEY,
HOW CAN WE CALCULATE THE SUM OF DIVISORS USING SEIVE APPROACH.?

Hey @CODER_JATIN
Follow this :Please explain how to calculate sum of divisors of any number

then this (if req) : How to calculate sum of all divisors

In the second approach that you’ve told me, is this is the formula that i need to remember?

and i’m not able to understand 1st approach, can you please again what actually we are doing?

Hey ,You dont have to remember that ,We did this in 11TH 12th
Say we have 6 so prime factorisation is 2,3
So sum of all divisors is =(1+2)*(1+3)
i,e Multiplication ((summation of gp of K^P)) where K is prime factor of N and P is max times K appear in prime factorisation.

Which one exactly? Please copy paste here:)

Hanji okay bbhaiya, i got understand

for ( int i=1; i<= sqrt (n); i++) { if (n%i == 0) { // If divisors are equal, print only one if (n/i == i) printf ( "%d " , i); else // Otherwise print both printf ( "%d %d " , i, n/i); } } Ye wala code bta do ek baar, ?

So N’s maximum diviosor is sqrt(n)
So for i=1 to sqrt(n) we check if i divides n
If it does then we gets its two divisors i and n/i (note here n/i >sqrt(n) result came from this (i)*(n/i)=n)
And if i=sqrt(n) divides n then we only add it once because in this case i and n/i are same

OkAY OKAY , bhaiya ek baar dobaara link bhejna jo aapne bheje they first reply mai, they are not showing now.

Hey @CODER_JATIN
Follow this :Please explain how to calculate sum of divisors of any number

then this (if req) : How to calculate sum of all divisors