but if k=1,
then option 2 will equal to option 1,
so it wont be k=1, therefore N is not prime,
is it correct?
*i still trying the method u ll saying,
thx for all the helps~
i will try my best to get what u all give~
I suspect the solution is to take k either the greatest divisor of N that is less than 4.47 or the smallest divisor of N greater than 4.47, based on evaluating the function for the fixed N. This is based on the assumption that (1) the OP is correct in his assessment of the expectation and (2) that k = 4.47 really does minimize the expectation. I believe the function is monotone on either side of the minimum, so I think this gives a solution.
Your rationale for excluding k = 4 is also highly dubious. There isn't any reason as far as I can tell based on your reasoning to think that k = 4 is outperformed by k = 5. You would have to actually check this.
EDIT: Incidentally, I ran this function through the optim function in R and got 5.02 for the argmin. However, 5 outperforms 6, so you should not round up.