clearvars, clc
digits(5000)
f=vpa(1); nxtno=2;
for n=1:11
rhs=p2(n);
disp([n rhs])
while f<rhs
f=f*nxtno; nxtno=nxtno+1;
end
if rhs==f
disp(f)
end
end
function pr = p2(n)
p0=vpa(2)^vpa(n);
p=vpa(1);
for i=p0-1:-1:p0-p0/2
p=p*vpa(i);
end
pr=p;
end
finds only n=1 and n=2, where the respective equal values are 1 and 6. The limit of testing was n=11 as beyond that the RHS becomes larger than the allotted 5000 digits (the program keeps building the factorial until it equals or exceeds the RHS).
Oh, yes, forgot: the k values are 1 and 3 respectively.
Edited on August 13, 2021, 10:35 am
|
Posted by Charlie
on 2021-08-13 09:22:08 |