I am given $A$ and $B$. I have to find out sum of $(m+n)$ for all pairs of numbers where $m\leq n$, $\gcd(m,n)=B$ and $\operatorname{lcm}(m,n)=A$
For $A=72$, $B=3$
Possible pairs will be - $(3,72)$, $(9,24)$
This is for a programming problem. I need to find sum for any given A and B.
2026-03-28 03:27:33.1774668453
Find sum of possible pairs for given LCM and GCD
749 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in ELEMENTARY-NUMBER-THEORY
- Maximum number of guaranteed coins to get in a "30 coins in 3 boxes" puzzle
- Interesting number theoretical game
- How do I show that if $\boldsymbol{a_1 a_2 a_3\cdots a_n \mid k}$ then each variable divides $\boldsymbol k $?
- Using only the digits 2,3,9, how many six-digit numbers can be formed which are divisible by 6?
- Algebra Proof including relative primes.
- How do I show that any natural number of this expression is a natural linear combination?
- Counting the number of solutions of the congruence $x^k\equiv h$ (mod q)
- algebraic integers of $x^4 -10x^2 +1$
- What exactly is the definition of Carmichael numbers?
- Number of divisors 888,888.
Related Questions in DIVISIBILITY
- Reciprocal-totient function, in term of the totient function?
- Can we find integers $x$ and $y$ such that $f,g,h$ are strictely positive integers
- Positive Integer values of a fraction
- Reciprocal divisibility of equally valued polynomials over a field
- Which sets of base 10 digits have the property that, for every $n$, there is a $n$-digit number made up of these digits that is divisible by $5^n$?
- For which natural numbers are $\phi(n)=2$?
- Interesting property about finite products of $111..1$'s
- Turn polynomial into another form by using synthetic division
- Fractions of the form $\frac{a}{k}\cdot\frac{b}{k}\cdot\frac{c}{k}\cdots=\frac{n}{k}$
- Proof: If $7\mid 4a$, then $7\mid a$
Related Questions in PRIME-FACTORIZATION
- For which natural numbers are $\phi(n)=2$?
- Fractions of the form $\frac{a}{k}\cdot\frac{b}{k}\cdot\frac{c}{k}\cdots=\frac{n}{k}$
- (Number of perfect powers ≤ n) ∼ $\sqrt{n}$?
- How do I solve complicated prime factorization problems? (Ex: 20711)
- Is there a pattern to addition of primesFactored numbers?
- Proof of Fundamental Theorem of Arithmetic: Uniqueness Part of Proof
- Find a prime factor of $7999973$ without a calculator
- Proof verification: Let $gcd(x,y)=1$. If $xy$ is a perfect square, then $x$ and $y$ are perfect squares.
- An idea for approaching Brocard's problem ($n!+1=m^2$)
- Looking for complex roots of unity which also happen to be complex primes
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
First, you can solve the case when $B=1$. The general case $A,B$ can be solved then by solving for $A_1=A/B, B_1=1$ and multiplying the answer by $B$.
So, given $A$ and $B=1$, prime factorize $A=p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k}$.
Then a pair $m,n$ with $\gcd(m,n)=1$ and $\mathrm{lcm}(m,n)=A$ is just a partition of the set of primes in $A$.
Turns out that this sum is:
$$\left(1+p_1^{a_1}\right)\left(1+p_2^{a_2}\right)\cdots\left(1+p_k^{a_k}\right)$$
The case $A=B=1$ is a special case, since it is possible for $m=n$ then, so you get $2$.
For example, in the case $A=24, B=1$, $A=2^3\cdot 3$ so the total is $(1+8)(1+3)=36$. And the case $A=72,B=3$ is therefore $3\cdot 36=108$.
First, let's just take the case $A=p^k$ for some prime $p$. Then there is only one pair, $m=1,n=p^k$ and the total is $1+p^k$.
Similarly, if $A=p_1^ap_2^b$, with $p_1^a<p_2^b$, the only pairs or $(m,n)=(1,A)$ or $(m,n)=(p_1^a,p_2^b)$ so the sum is $1+p_1^a+p_2^b+p_1^ap_2^b = (1+p_1^a)(1+p_2^b)$.
In general, for $A>1$, the sum is the sum of all divisors $d$ of $A$ such that $\gcd(d,A/d)$. The trick is to realize that your term $m+n$ is really two separate values of $d$.
It's not clear how efficient this algorithm is - it depends on prime factorization, which is relatively hard in general.