### Theorem 4.7

Let be a cubic form. This algorithm outputs true or false according to whether F corresponds to the image of a cubic field by the Davenport-Heilbronn map.
• If F is not irreducible, return false.
• If F is not primitive, return false.
• Compute the Hessian by the formulas given. Set , (so ). Using Proposition 3.3, check that and , otherwise return false.
• If for some p>3, return false.
• Set . Remove all powers of 2 and 3 from t (in fact at most and ), and let again t be the result. If return false.
• If t is squarefree return true, otherwise return false.

### Proof

Steps 1, 2 and 3 are clear since is irreducible, primitive and belongs to for all p.

If , then . If and , we have . It follows in both cases that if p>3, we have so by Proposition 3.3, thus Steps 4 and 5.

Assume that for every prime p>3, we have and , which is the situation at the beginning of Step 6. Then if t is not squarefree, there exists p>3 such that and hence . Since p>3, it follows that , hence that , denoting by what we called ``f'' in the preceding sections, such that for a fundamental discriminant . But by Proposition 3.4, this means that either , or else F has a double root modulo p such that . Since , by Propostion 3.3 (2), is not of the form , hence must be of the second form which means that as we have seen.

On the other hand if t is squarefree, then for every p>3 we have either , and since and , so , or else , but then by Proposition 3.3 (2), and since we have hence since we have so by Proposition 3.3 (3).

This terminates the proof of the algorithm.