Cubic hypersurfaces of complex projective space Given the equation of a cubic hypersurface $C\subset\mathbb{P}^{N}_{\mathbb{C}}$ ($N\geq 4$), 
there is an algorithm (or better a software) that allows to determine if $C$ is factorial (i.e., all of whose local rings are unique factorization domains, and
hence there is no distinction between Cartier divisors and Weil divisors), 
and if $\mathrm{Pic}(C)=\mathbb{Z}\langle\mathcal{O}_C(1)\rangle$ ?
Of course this is trivial if $C$ is smooth.
Thanks.
 A: First concerning your question: most people use $\operatorname{Pic}(C)$ for Cartier divisors. I interpret your question as follows: you want to determine whether every divisor on $C$ is linear equivalent with a Cartier divisor (this means factorial).
Now if $C$ is smooth this is true and I think this is also true if $\dim C-\dim C_{sing}>3$.
If $\dim C_{sing}\geq \dim C-3$ things are much more complicated. A necessary condition for being factorial is (roughly said) that the rank of $H^{N-2,N-2}(C,\mathbb{C}) \cap H^{2N-4}(C,\mathbb{Z})$ equals one. (If the MHS on H^{2N-2}$ does not have pure weight you have to be a bit more careful here.)
If $\Sigma=C_{sing}$ then you have an exact sequence
$$H^{2N-5}(C)\to H^{2N-5}(C\setminus \Sigma)\to H^{2N-4}_\Sigma(C)\to H^{2N-4}(C).$$
If I remember correctly there should be a copy of $H^2(\Sigma) $ inside 
$H^{2N-4}_{\Sigma} (C)$. 
If this is all of $H^{2N-4}_\Sigma$ then you can relatively easily show that $H^{2N-4}(C)$ is one-dimensional and hence each divisor on $C$ is homologically equivalent to a Cartier divisor.
If $H^{2N-4}_\Sigma(C)$ is bigger then $H^2(\Sigma)$ things are getting complicated.
In the case that $\dim \Sigma=0$, i.e., $C$ has isolated singularities then the only interesting case is $N=4$. Now $H^4_\Sigma$ is the part of the cohomology of the Milnor fiber that is invariant under the monodromy. This can be calculated using Singular.
In some case you can actually calculate the cokernel $K$ of
$H^3(C\setminus \Sigma)\to H^4_\Sigma(C)$.
For this see e.g., Dimca's paper on Betti numbers and defects of linear systems.
It turns out that $K$ is the primitive cohomology group $H^4(C,\mathbb{C})$
The formula Francesco mentioned is a special case of Dimca's approach.
Grooten-Steenbrink and Hulek-K. gave similar formula as Dimca for certain classes of nonisolated singularities.
A: As Parsa explained in his comment, we always have $\textrm{Pic}(C)=\mathbb{Z}$ by Grothendieck.-Lefschetz. However, when $C$ is not smooth this does not mean that $C$ is factorial, that is that every Weil divisor is Cartier. 
So we must understand when this happens.
I do not know whether there are satisfactory results in every dimension and for any type of singularities.
Let me give an answer for $N=4$, under the condition that $C$ has only isolated ordinary double points ("nodes").
Then there is the following result:
Theorem. Let $C \subset \mathbb{P}^4$ be a hypersurface of degree $d$ with at most ordinary double points as singularity. Let $\Sigma:=\textrm{Sing}(C)$. Then the following are equivalent:


*

*every divisor on the threefold $C$ is Cartier;

*every surface $S \subset C$ is cut out on $C$ by an hypersurface in $\mathbb{P}^4;$

*the set $\Sigma$ imposes independent linear conditions on linear forms of degree $2d-5$.


In other words, $C$ is factorial if and only if 
$$H^1(\mathcal{O}_{\mathbb{P}^4}(2d-5) \otimes \mathcal{I}_{\Sigma})=0. \quad (\star)$$
If you have an explicit equation for $C$, you can easily check whether condition $(\star)$ holds by using Macauley2.
Cheltsov showed that that if $|\Sigma| <(d-1)^2$ then $C$ is factorial. For instance, a nodal cubic with at most $8$ nodes is factorial.
This result does not hold if  $|\Sigma|=(d-1)^2$: in fact, any hypersurface of the form
$$x_0F+x_1G=0,$$
with $F$ and $G$ general linear forms of degree $d-1$, is not factorial since it contains the $2$-plane $x_o=x_1=0$: notice that there are $(d-1)^2$ nodes on this plane. 
For more details on these topics see [I. Cheltsov, Factorial Threefold hypersurfaces, J. Algebraic geometry
19 (2010), no. 4, 781–791] and the references given there.
