Find all possible pairs (n, k) of positive integers that satisfy this equation:
n! + n = n^k
for n=vpa(1):2000
lhs=factorial(n)+n;
logrhs=log(lhs);
k=logrhs/log(n);
if abs(k-round(k))<.00001
disp([n,factorial(n),k])
end
end
finds
n n! k
[2.0, 2.0, 2.0]
[3.0, 6.0, 2.0]
[5.0, 120.0, 3.0]
|
Posted by Charlie
on 2025-02-21 10:29:29 |