Sometimes I (inadvertently or naively) write a code that would take Mathematica a long time to compute on my laptop or any computer for that matter. For example: Table[Length[Select[Permutations[n], #[[1]] == 1 &]], {n, 1, 10}]. This returns {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880} in about ten seconds. But if I want more terms (even one more) it takes Mathematica much too long to compute.
I usually have to close the program and restart a new session or sometimes I have to unplug my laptop and remove the batteries and restart the computer. Is there an easier way to stop the computation? Is it harmful to my laptop when Mathematica runs a "slow code" for a long period of time (say 10 -15 hours)?
Table[(n - 1)!, {n, 1, 10}]
:) $\endgroup$Array
:Array[#! &, 10, 0]
$\endgroup$