Let $K$ be the quadratic field $\mathbb{Q}(\sqrt d)$ where $d\in\mathbb{N}_{\geq1}$ is square-free, and let $\mathbb{Z}_K$ be the ring of integers of $K$. Define the fundamental unit of $\mathbb{Z}_K$ as the minimal invertible element of $\mathbb{Z}_K$ larger than $1$.
We can necessarily write this fundamental unit as $a+b\sqrt d$ where $a,b\in\mathbb{Q}^+$. Then, since it is invertible, its field norm $a^2-db^2$ is $\pm1$. Here is what the sign of this norm ends up being for the first bunch of values of $d$.
$2$ $-$
$3$ $+$
$5$ $-$
$6$ $+$
$7$ $+$
$10$ $-$
$11$ $+$
$13$ $-$
$14$ $+$
$15$ $+$
$17$ $-$
$19$ $+$
$21$ $+$
$22$ $+$
$23$ $+$
$26$ $-$
$29$ $-$
$30$ $+$
Given $d$, is there a way to tell what this sign will be, than computing the fundamental unit and its product with its conjugation? I'm also curious what more advanced concepts this sign may be related to.