Given:
f(x)=Sum[x/n!] for all positive integers n, where the [] brackets define the integer part of x (e.g. [pi]=3)
What is x, if f(x)=1215
while 1==1
x=input('x:');
tot=0;
for n=1:20
tot=tot+floor(x/factorial(n));
end
disp(tot)
end
asks the user to specify x, and then gives the value of f(x).
My inputs and the program's responses:
>> integersOnly
x:100
170
x:500
857
x:1100
1888
x:1050
1802
x:1000
1716
x:800
1373
x:700
1200
x:701
1201
x:715
1225
x:710
1217
x:709
1215
x:708
1214
x:
Operation terminated by user during integersOnly
The answer is x = 709.
|
Posted by Charlie
on 2023-09-25 08:39:48 |