The LaTeX command for complexity P (๐ฏ) is \mathsf{P} (P complexity class).
\mathsf{P}Writing a paper? The table generator and the BibTeX cleaner are one click away, no account.
Write \mathsf{P} inside math mode, that is between $โฆ$ for inline math or in a \[ โฆ \] or equation block for display math. It is part of core LaTeX math, so no extra package is required.
In pseudocode or running text, wrap \mathsf{P} in $...$ so it keeps math spacing and fonts. With unicode-math under XeLaTeX or LuaLaTeX, typing ๐ฏ in a formula gives the same symbol.
Open this example in the live preview: it renders as you type, with no compiler and no signup.
\mid\lfloor x \rfloor\lceil x \rceil\top\bot\models\mathsf{NP}\mathcal{O}\Omega\Thetao\oplus\land\lorComputer science symbols in LaTeX: the full table or search all 350+ LaTeX symbols.
Use \mathsf{P} in math mode; it needs no extra package. For example, $\mathsf{P}$.
None: \mathsf{P} is built into LaTeX, so no extra package is required.