If a binary quadratic form primitively represents $n$ and $n^3$, must it be the identity form? I've been searching numerically, and whenever a positive definite binary quadratic form can primitively represent an integer $n>1$ and $n^3$, it turns out to be equivalent to the identity form in that class group.
Is there some elementary way to see that this is only possible for identity forms?

Here is what initially gave me hope that it could be possible with other forms.
For any binary quadratic form $A x^2 + B xy + C y^2$, if it can represent integers $r$, $s$, $t$ then it can also represent $rst$.
This can be seen as follows:

*

*For any form with coefficients $(A,B,C)$, in the class group its inverse is $(A,-B,C)$.


*Both a form and its inverse can represent the same numbers (if $(x,y)$ with the former, use $(x,-y)$ with the later).


*If a form can represent $r$ with $(x_1,y_1)$, and $s$ with $(x_2,y_2)$ then the identity form can represent $rs$ with some integers $(u,v)$ due to form composition:
$$
\begin{aligned}
rs &= (A x_1^2 + B x_1 y_1 + C y_1^2)(A x_2^2 + B x_2 y_2 + C y_2^2) \\
   &= (A x_1^2 + B x_1 y_1 + C y_1^2)(A x_2^2 - B x_2 (-y_2) + C (-y_2)^2) \\
   &= I(u,v) \\
\end{aligned}
$$


*Futhermore, if the form can represent $t$ with $(x_3,y_3)$, then it can represent $rst$ by some integers $(x_4,y_4)$ due to form composition.

$$rst = I(u,v)(A x_3^2 + B x_3 y_3 + C y_3^2) = (A x_4^2 + B x_4 y_4 + C y_4^2)$$
It is definitely possible to primitively represent cubes, for example
a) 2 x^2 - xy + 6 y^2 = 3^3  with x=3,y=-1
b) 2 x^2 - xy + 6 y^2 = 8^3  with x=2,y=-9

But in example 'a', it is not possible for that form to represent 3. While in example 'b', the form can represent 8, but not primitively (x=2,y=0).
This seems to be the case for any form not equivalent to an identity form.
While for an identity form, I've been able to find a lot of examples that work.
    x^2 + xy + 12 y^2 = 18     with x=2, y=1, gcd(x,y)=1
    x^2 + xy + 12 y^2 = 18^3   with x=-76, y=7, gcd(x,y)=1

    x^2 + xy + 12 y^2 = 118    with x=2, y=3, gcd(x,y)=1
    x^2 + xy + 12 y^2 = 118^3  with x=964, y=207, gcd(x,y)=1

    x^2 + xy + 12 y^2 = 63     with x=3, y=2, gcd(x,y)=1
    x^2 + xy + 12 y^2 = 63^3   with x=-501, y=2, gcd(x,y)=1

Can one prove that if a form can primitively represent $n$ and $n^3$, that is must be equivalent to the identity form?

UPDATE:
A related question On products of ternary quadratic forms $\prod_{i=1}^3 (ax_i^2+by_i^2+cz_i^2) = ax_0^2+by_0^2+cz_0^2$ shows a possible solution for any form with B=0 (all that is left is to analyze if the result is a primitive representation). Such forms are in the same equivalence class as its inverse in the class group, and are called "ambiguous forms".
Below Will Jagy gave an explicit solution for an ambiguous form which is not equivalent to the identity form, showing that the result can be a primitive representation.
The connection to what I tried is that the identity is always an ambiguous form. So that likely refines the question to:

If a form can primitively represents $n$ and $n^3$, is the form necessarily an ambiguous form?

 A: As Will Jagy said in his answer, it is simplest to consider the case that $n$ is a prime $p$ not dividing the discriminant. Then if $p$ is represented by some form of the given discriminant, this form is unique up to equivalence, and each power $p^k$ is also represented by a unique form up to equivalence. In terms of the class group, if the form $Q$ represents $p$ then the forms representing $p^k$ are precisely $Q^k$ and $Q^{-k}$.  (A form and its inverse in the class group always represent exactly the same numbers. Throughout this answer I am using the term "represent" to mean "primitively represent".)
Thus if $Q$ represents both $p$ and $p^k$ then we must have $Q^k=Q$ or $Q^k=Q^{-1}$ in the class group, or in other words either $Q^{k-1}$ or $Q^{k+1}$ is the identity element in the class group. Taking $k=3$ as in the question, we see that $p$ and $p^3$ are represented by the same element of the class group exactly when this element has order dividing $4$.
There are plenty of examples.  The simplest might be discriminant $-15$ with class group cyclic of order $2$ generated by the form $Q(x,y)=2x^2+xy+2y^2$.  The primes not dividing the discriminant that are represented by $Q$ are the primes congruent to $2$ or $8$ mod $15$.  In particular $Q(1,0)=2$ and $Q(-1,2)=2^3$. The next prime would be $17$, and $Q(-1,3)=17$ but I wouldn't want to solve $Q(x,y)=17^3$ by hand, though the general theory says that a solution exists.
Another example would be discriminant $-56$ as in Will Jagy's answer.  Here the class group is cyclic of order $4$ generated by the form $Q(x,y)=3x^2+2xy+5y^2$. This form represents exactly the primes congruent to $3,5,13,19,27$, or $45$ mod $56$, so primes in these congruence classes give examples. The first two are $Q(1,0)=3$ and $Q(0,1)=5$ with $Q(1,2)=3^3$ and $Q(6,1)=5^3$.
Allen Hatcher
(Stackexchange thinks I am a new user here, which I am not, so it created a new account for me. If someone knows how to combine the new account with my old one, please do so or tell me how to do it.)
A: Too big for a comment,
this is mostly observations, perhaps incorrect, that may help you find an answer that makes sense to you.
Perhaps I'm missing the point. I'm not sure what you mean by "identity form" even after trying to look it up.
If we allow  $B=2$, one of your "forms" appears to be
$$(x_1+y_1)^2(x_2 -y_2)^2=x_3^4-2x_3^2y_3^2+y_3^4=(x_3^2-y_3^2)^2
$$
Take a look at Euclid's formula where your $(x,y)$ are represented by $(m,k).\quad$
$$ \quad A=m^2-k^2,\quad B=2mk,\quad C=m^2+k^2\quad$$
The only restrictions are $m> k>0\quad GCD(m,k)=1\space$ for non-trivial primitives.
The $A$-value takes the form $(2n+3);\quad$ the $B$-value takes the form $4n;\quad $ the $C$ value takes the form $4n+1.\quad$ Any of these can be cubes. Even $C\in\{5^3, 13^3, 17^3, 53^3, 241^3,\cdots\}$
Your form appears to the square of side-$A$ of a Pythagorean triple. and there are easy ways of finding $m,k$ values if any of $A,B,C$ are given.
