Can i get a hint? If I use big factorial? Or do something else completely?
HINT FOR THE QUES PLS
@sshreya2912
For a given integer x,
you need to find the number of pairs <a,b> such that gcd(a,b)=1.
So, you need to find the number of pairs <a, x!/a> such that a ϵ {factors of x!}.
OR
It follows a pattern. I can give you a hint.
The task is to factor n! into a and b such that gcd(p,q)=1 and p<q. so we calculate the number of distinct primes in n!
Let prime factorisation of n!= (p1)^x1 * (p2)^x2 …(pk)^xk
now for each i, (pi)^xi can either go in p or q. hence 2^k ways. but as we want p<q. therefore only 2^(k-1) ways.
Hope, this would help.
Check this code if you implementation issues, https://ide.codingblocks.com/s/269499
n! can be stored in long long, or do I need to apply big number factorial or someting?
@sshreya2912
Our objective is to factor n! into p and q such that hcf(p,q)=1 and p<q. so we calculate number of distinct primes in n!
let prime factorisation of n!= (p1)^x1 * (p2)^x2 … (pk)^xk
now for each i, (pi)^xi can either go in p or q. Hence 2^k ways. but as we want p<q. therefore only 2^(k-1) ways. That’s why in code, counting primes is started from 3 because ultimately we would have to subtract 1 from k. Go through the code