# Updated:Sum of entries in continued fraction of $\sqrt d$ and $\sqrt{d}-\lfloor \sqrt{d}\rfloor$ equals (divides) $d$.

(1)I noted as a joke in class, for $\sqrt{13}$ which has continued fraction expansion $[3;\overline{1,1,1,1,6}]$ that $3+1+1+1+1+6=13$. Another eg. $\sqrt{22}=[4;\overline{{1,2,4,2,1,8}}]$, as $4+1+2+4+2+1+8=22$

I am curious as to when this happens for the continued fractions of $\sqrt{d}$, $d$ a non-square positive integer.

(2)Or in a similar question if we consider the continued fraction of $\sqrt{d}-\lfloor \sqrt{d}\rfloor$ for what $d$ does the periodic part sum to $d$:

examples: $\sqrt2-1=[0;\overline{\bf{2}}]$ $\sqrt3-1=[0;\overline{\bf{1,2}}]$, $\sqrt6-2=[0;\overline{\bf{2,4}}]$, $\sqrt7-2=[0;\overline{\bf{1,1,1,4}}]$.

Apparently it can be shown that the last digit in the entry of the periodic terms of $\sqrt{d}$ is $2\lfloor \sqrt d \rfloor$. This is a lower bound for the second question. If we sum the entries incl. the first term it's at least $3\lfloor \sqrt d \rfloor$, which is a lower bound for the sum in the first question.

Any information would be interesting to me. I haven't thought about this too much, so apologies for the brief "attempt", and very few examples.

Update: I'm starting to think these are the only examples (I expect $d$ grows much faster than the sum of it's continued fraction entries).

So possibly extending the question to when is $d$ divisible by either of the two sums above, might be a more interesting question.

Running gap code I found up to 1000:

for [new] (1): $[ 13, 22, 96, 180, 305, 385, 490, 696, 936 ]$

for [new] (2): $[ 2, 3, 6, 7, 20, 42, 52, 72, 110, 130, 140, 156, 210, 272, 276, 310, 342, 378, 420, 506, 520, 600, 660, 702, 742, 812, 846, 858, 884, 930 ]$