How many pairs(A,B) are there up to n such that GCD(A,B)=B without those pairs(A,B), where B^2=A.
If we consider 5 as n we have 25 possible pairs.They are (1,1),(1,2),(1,3),(1,4),(1,5),(2,1),(2,2),(2,3),(2,4),(2,5),...,(5,5).
Of them, 8 pairs satisfy the above condition.My main objective is to find out the number
of such pairs if n is given with a efficient method.One of my friends showed me a method but he didn't state the reasoning behind it.
Here,I'm presenting his method for n=10.
2 * ((floor(10/1) - 1) + (floor(10/2) - 2) + (floor(10/3) - 3))
= 2 * ((10 - 1) + (5 - 2) + (3 - 3))
= 2 * (9 + 3 + 0)
= 24
Can anyone explain the reasoning behind the above method in details and clearly?
If we consider 5 as n we have 25 possible pairs.They are (1,1),(1,2),(1,3),(1,4),(1,5),(2,1),(2,2),(2,3),(2,4),(2,5),...,(5,5).
Of them, 8 pairs satisfy the above condition.My main objective is to find out the number
of such pairs if n is given with a efficient method.One of my friends showed me a method but he didn't state the reasoning behind it.
Here,I'm presenting his method for n=10.
2 * ((floor(10/1) - 1) + (floor(10/2) - 2) + (floor(10/3) - 3))
= 2 * ((10 - 1) + (5 - 2) + (3 - 3))
= 2 * (9 + 3 + 0)
= 24
Can anyone explain the reasoning behind the above method in details and clearly?
Last edited: