Code I get from wolfram isn't working in mathematica

You can chalk this up as a W|A bug.

We do indeed try to factor with the approach stated by OP. When that times out, we try a different approach, but fail to update the code provided to the user.

The approach used in the timeout case is essentially

poly = s^5 + 32s^4 + 363s^3 + 2092s^2 + 5052s + 4320;
sols = s /. Solve[poly == 0, s];

N[Times @@ (s - sols)]
((2.04832 - 0.52209 I) + s) ((2.04832 + 0.52209 I) + s) ((5.55913 - 5.16689 I) + s) ((5.55913 + 5.16689 I) + s) (16.7851 + s)

(Remove N to see the exact solution.)

Edit

This has been fixed now and will appear once W|A hits its next release cycle. The code will be

With[{poly = s^5 + 32 s^4 + 363 s^3 + 2092 s^2 + 5052 s + 4320},
  Coefficient[poly, s, Exponent[poly, s]] Apply[Times, s - (s /. Solve[poly == 0, s])]
]

Edit 2

This has been fixed for a few weeks now: enter image description here


I believe your question is completely valid and I gave it a big upvote. Assuming that WolframAlpha did indeed use this command to get the result, I'm not sure on what mystical machine they ran it on.

I let it evaluate for several hours on the latest Mathematica version without success and my machine is pretty strong performance wise. I also tested older versions with the same result.

The only thing I can state is that it is indeed supposed to work. You can try a slightly simpler version of this problem by taking out the highest powers

Factor[4320 + 5052 s + 2092 s^2, 
  Extension -> Flatten[s /. Solve[4320 + 5052 s + 2092 s^2 == 0, s]]]
(* 
  1/523 (-1263 I + 3 Sqrt[73799] - 1046 I s) (1263 I + 3 Sqrt[73799] + 1046 I s)
*)

If you are really interested in this, then I would write to Wolfram support.

Edit:

I did not notice that Chip works with the W|A team. Please see his answer which reflects what Wolfram support sent me:

Thank you for contacting Wolfram Technical Support.

As user Chip Hurst (a Wolfram|Alpha developer here) mentioned in his comment, this is an issue with Wolfram|Alpha returning the wrong expression it actually used to obtain the result. We hope to address this W|A issue soon.

We appreciate you taking the time to bring this to our attention. Please do not hesitate to contact us with anything else you come across while using our products.