Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
Let's choose a small value for n (since the input command cannot run on MATLAB Answers) and see what you're trying to pass into the solve function.
n = 3;
syms p
R = repmat({[p, p-1]}, 1, n);
T = combinations(R{:});
disp(['Combinations of vars repeated ', num2str(n), ' times:']);
disp(T);
pm = log(prod(T, 2));
ps = prod(T, 2);
k = ps .*pm ;
disp('Product of each combination:');
disp(k)
sm = sum(k);
disp(sm)
sf = diff(sm, p)
The solve function is not designed to accept a table as the first input. But if you extract the value from the table and use that in your solve call:
sol = solve(sf.prod == 0, p)
Or if you extracted the matrix of symbolic variables from the table before you started operating on it:
T2 = T.Variables
pm = log(prod(T2, 2));
ps = prod(T2, 2);
k = ps .*pm ;
sm = sum(k);
sf2 = diff(sm, p);
sol2 = solve(sf2 == 0, p)
isequal(sf2, sf.prod)