# Find all triplets $(a,b,c)$ less than or equal to 50 such that $a + b +c$ be divisible by $a$ and $b$ and $c$.

Find all triplets $$(a,b,c)$$ less than or equal to 50 such that $$a + b +c$$ be divisible by $$a$$ and $$b$$ and $$c$$.(i.e $$a|a+b+c~~,~~b|a+b+c~~,~~c|a+b+c$$) for example $$(10,20,30)$$ is a good triplet. ($$10|60 , 20|60 , 30|60$$).

Note: $$a,b,c\leq 50$$ and $$a,b,c\in N$$.

In other way the question says to find all $$(a,b,c)$$ such that $$lcm(a,b,c) | a+b+c$$

After writing different situations, I found that if $$gcd(a,b,c) = d$$ then all triplets are in form of $$(d,2d,3d)$$ or $$(d,d,d)$$ or $$(d,d,2d)$$ are answers. (of course the permutation of these like $$(2d,3d,d)$$ is also an answer). It gives me $$221$$ different triplets. I checked this with a simple Java program and the answer was correct but I cannot say why other forms are not valid. I can write other forms and check them one by one but I want a more intelligent solution than writing all other forms. Can anyone help?

My java code: (All of the outputs are in form of $$(d,d,d)$$ or $$(d,2d,3d)$$ or $$(d,d,2d)$$ and their permutations.)

import java.util.ArrayList;
import java.util.Collections;

public class Main {
public static void main(String[] args) {
int count = 0;
for (int i = 1; i <= 50; i++) {
for (int j = 1; j <= 50; j++) {
for (int k = 1; k <= 50; k++) {
int s = i + j + k;
if (s % i == 0 && s % j == 0 && s % k == 0 && i != j && j != k && i != k) {
ArrayList<Integer> array = new ArrayList<Integer>();
array.clear();
int g = gcd(gcd(i, j), k);
Collections.sort(array);
int condition = 4; //To find out whether it is (d,d,d) or (d,d,2d) or (d,2d,3d)
if (array.get(0) == 1 && array.get(1) == 1 && array.get(2) == 1) {
condition = 1;
}
if (array.get(0) == 1 && array.get(1) == 1 && array.get(2) == 2) {
condition = 2;
}
if (array.get(0) == 1 && array.get(1) == 2 && array.get(2) == 3) {
condition = 3;
}
System.out.printf("%d %d %d ::: Condition: %d\n", i, j, k, condition);
count++;
}
}
}
}
System.out.println(count);
}

public static int gcd(int a, int b) {
if (b == 0) {
return a;
} else
return gcd(b, a % b);
}
}

• ... I recall seeing this question yesterday... – Servaes Apr 2 at 16:14
• @Servaes I used the search and didn't find this question. But as you said,I checked and found it. I am not the same person. Maybe his source and I was the same because I was investigating homework of a discrete mathematics course of a university and I found this question and he/she stated that it is his homework.I found the question interesting and asked it here. I completely checked the conditions with a Java program and find tested my hypothesis but I don't know how to prove it without checking all different forms. for better clarification, I'll add my java code to the problem. – amir na Apr 2 at 16:47
• What does a triplet being less than $50$ mean? That each term is less than 50? are you assuming each term is non-negative? – fleablood Apr 2 at 16:53
• Also what does "m is divisible to k" mean? Does that mean $\frac km$ is an integer? Or that $\frac mk$ is an integer? Or something else? I usually hear "m is divisible by k" to mean $\frac mk$ is an integer. – fleablood Apr 2 at 16:55
• @Servaes math.stackexchange.com/questions/3170626/… I didn't find this in search because the title of that question is not very good and don't have the actual question and I think stack Exchange only search by title. – amir na Apr 2 at 16:57

If $$a\leq b\leq c$$ then $$c\mid a+b+c$$ implies $$c\mid a+b$$ and so $$a+b=cz$$ for some $$z\in\Bbb{N}$$. Then $$cz=a+b\leq2b\leq2c,$$ and so $$z\leq2$$. If $$z=2$$ then the inequalities are all equalities and so $$a=b=c$$. Then the triplet $$(a,b,c)$$ is of the form $$(d,d,d)$$.

If $$z=1$$ then $$c=a+b$$, and then $$b\mid a+b+c$$ implies that $$b\mid 2a$$. As $$b\geq a$$ it follows that either $$b=a$$ or $$b=2a$$. If $$b=a$$ then $$c=2a$$ and the triplet $$(a,b,c)$$ is of the form $$(d,d,2d)$$. If $$b=2a$$ then $$c=3a$$ and the triplet $$(a,b,c)$$ is of the form $$(d,2d,3d)$$.

This allows us to count the total number of triplets quite easily;

1. The number of triplets of the form $$(d,d,d)$$ is precisely $$50$$; one for each positive integer $$d$$ with $$d\leq50$$.
2. The number of triplets of the form $$(d,d,2d)$$ is precisely $$25$$; one for each positive integer $$d$$ with $$2d\leq50$$. Every such triplets has precisely three distinct permutations of its coordinates, yielding a total of $$3\times25=75$$ triplets.
3. The number of triplets of the form $$(d,2d,3d)$$ is precisely $$16$$; one for each positive integer $$d$$ with $$3d\leq50$$. Every such triplets has precisely six distinct permutations of its coordinates, yielding a total of $$6\times 16=96$$ triplets.

This yields a total of $$50+75+96=221$$ triplets.

• Simple code finds $221$. – David G. Stork Apr 4 at 4:56
• @DavidG.Stork A simple count shows the same ;) – Servaes Apr 4 at 13:29