Determine all possible pairs (x,y) of non-negative integers that satisfy this equation:
(x!+1)(y!+1)= (x+y)!
wlog, let y>=x
For (x+y)>4, (x+y)! ends in 0
So if (x+y)>4, the RHS ends in zero, therefore and one of x! or y! must end in 4, the other must be odd to get a LHS with an even number times a number ending in 5.
The only odd factorial is 1 which is 0! or 1!
The only factorial ending in 4 is 24 which is 6!
(1!+1)(4!+1) = 50 which does end in zero but is not 5!
There is no other way for the LHS to end in zero.
Thus x+y <= 4 so there are only 15 (x,y) pairs that pass this test (only 9 if y>=x)
This is small enough to check all manually and determine that the only solution is:
(1,2) or (2,1)
But a little further analysis narrows it down without testing all 9:
The factorials of 0,1,2,3,4 end in 1,1,2,6,4
Adding one, each factor on the LHS can end in 2,2,3,7,5
What ways can two factors chosen from {2,3,7,5} end in {1,2,6,4}?
2*2=4
2*3=6 <-- x=1,y=2 works
2*7=14
3*7=21
A quick glance at the RHS results shows that only 6 is a factorial
And for overkill, a program:
----------------
def fact(n):
if n == 1 or n == 0:
return 1
ans = 1
for i in range(n):
ans *= (i+1)
return ans
for x in range(100):
for y in range(x,100):
if (fact(x)+1)*(fact(y)+1) == fact(x+y):
print(x,y)
|
Posted by Larry
on 2023-09-07 08:49:14 |