The square root of the square root of the square root of the… This code-golf challenge will give you an integer n, and ask you to count the number of positive integer sequences \$S = (a_1, a_2, \dots, a_t)\$ such that

\$a_1 + a_2 + \cdots + a_t = n\$, and
\$\displaystyle
\sqrt{a_1+\sqrt{a_2 + \cdots + \stackrel{\vdots}{\sqrt{a_t}}}}
\$ is an integer.

Example
If n = 14, then there are 8 such sequences:

\$\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{3+\sqrt{1}}}}}}} = 2\$
\$\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2+\sqrt{4}}}}}} = 2\$
\$\sqrt{1+\sqrt{7+\sqrt{2+\sqrt{3+\sqrt{1}}}}} = 2\$
\$\sqrt{2+\sqrt{1+\sqrt{7+\sqrt{3+\sqrt{1}}}}} = 2\$
\$\sqrt{2+\sqrt{2+\sqrt{1+\sqrt{8+\sqrt{1}}}}} = 2\$
\$\sqrt{1+\sqrt{7+\sqrt{2+\sqrt{4}}}} = 2\$
\$\sqrt{2+\sqrt{1+\sqrt{7+\sqrt{4}}}} = 2\$
\$\sqrt{2+\sqrt{2+\sqrt{1+\sqrt{9}}}} = 2\$

(In this example, all of the nested square root expressions are equal to 2, but in general, this may not be the case.)
Pairs \$(n,(a(n))\$ for \$n \leq 25\$:
(1,1),(2,0),(3,0),(4,2),(5,0),(6,2),(7,0),(8,2),(9,2),(10,4),(11,2),(12,6),(13,2),(14,8),(15,4),(16,14),(17,6),(18,20),(19,8),(20,28),(21,14),(22,44),(23,20),(24,66),(25,30)


Your code must be robust against floating-point errors, that is it must work for arbitrarily large inputs, in principle.
Since this is a code-golf challenge, the shortest code wins.

(This is now on the On-Line Encyclopedia of Integer Sequences as
A338271. Sequence A338268 has been added too, based on Bubbler's \$f\$ function.)
APL (Dyalog Unicode), 39 bytes

+/⊢{∨/⍺⍵&lt;⍵0:0⋄⍺=0:1⋄+/∊∇¨/⍺(⍵*2)-⊂⍳⍺}¨⍳

Try it online!
A tacit function containing an inner dfn to use recursion. Does not use floating point numbers at all.
How it works
First of all, observe that
$$
\displaystyle
\sqrt{a_1+\sqrt{a_2 + \cdots + \stackrel{\vdots}{\sqrt{a_t}}}} \le \cdots \le \sqrt{a_1+a_2 + \cdots + a_t} \le a_1+a_2 + \cdots + a_t = n
$$
and this holds for all suffixes of any given sequence of positive integers.
Let's define a function \$f(x,y)\$ as the number of sequences where the sum is \$x\$ and the &quot;root sum&quot; is \$y\$. Then the following holds:
$$
\begin{align}
f(0, 0) &amp;= 1 \\
f(0, y) &amp;= 0, \qquad 0 &lt; y \\
f(x, y) &amp;= 0, \qquad x &lt; y \text{ or } y &lt; 0 \\
f(x, y) &amp;= \sum_{i=1}^{x}{f(x-i, y^2-i)}
\end{align}
$$
Then the desired result is the sum \$\sum_{i=1}^{n}{f(n,i)}\$.