Is there a proof that there is no such number that makes a pythagorean triple with sum and product of its digits?

102 Views Asked by At

My programming professor recently gave us a task to make a program that prints "every integer smaller than given integer n for which its sum of digits, product of digits and itself make up a pythagorean triple". I suspect that there are no such numbers, and that the program wouldn't output anything. Is there a proof for that?

1

There are 1 best solutions below

2
On BEST ANSWER

Call the number $N$, the sum of its digit $S$ and the product of its digits $P$.

Clearly $N$ must have more than one digit.

It cannot have a 0, because then $P=0$. So in particular its second digit must be $\ge1$,

Suppose its first digit is $a$ and it has $k$ other digits. Then $N>10^ka+10^{k-1}$, $P\le 9^ka$ and $S\le 9k+a$, so $S+P=a(9^k+9\frac{k}{a}+1)\le a(9^k+9k+1)$

For $k\ge4$ we have $a(9k+1)\le9(9k+1)<10^{k-1}$ and $9^k<10^k$, so $S+P<N$.

For $k=2$ let the second digit $b>1$, then $S=a+b,P=ab,N=10a+b$ and so $S+P=a(b+1)+b\le 10a+b=N$ and we cannot have a Pythagorean triple.

Similarly for $k=3$, let the number be $abc$. Then $S+P=a+b+c+abc,N=100a+10b+c$. Now $ab<11a<11a+b$, so $P=abc<9(11a+b)$. Hence $S+P<99a+9b+(a+b+c)=N$. So again no Pythagorean triple is possible.