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);
array.add(i / g);
array.add(j / g);
array.add(k / g);
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);
}
}
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;
This yields a total of $50+75+96=221$ triplets.