I manually evaluate this cell to set Prime[0]
Unprotect[Prime]
Prime[0] = 1
Protect[Prime]
I manually evaluate this cell to reset Prime[0]
Unprotect[Prime]
Prime[0] =.
Protect[Prime]
In case I forget to do it, is there a way to automatically evaluate the second cell when I close the nb?
Motivation
I'm working with bags of primes and want to use $p_0$ as the bag for all prime greater than the square-root of some $n$.
Displayed as: $\left\{p_0^1,p_1^5,p_2^2,p_3^1,p_4^1\right\}$
With counts as: $\left\{1,5,2,1,1\right\}$
NotebookEventActions[]? – J. M.♦ Sep 3 '12 at 7:03prime[x_Integer /; x >= 0] := If[x == 0, 1, Prime[x]]as another approach. – Vitaliy Kaurov Sep 3 '12 at 7:07