A closed-form solution might be given by a tree. Valuations of quadratic polynomials
by A. Byrnes, J. Fink, G. Lavigne, I. Nogues, S. Rajasekaran, A. Yuan, L. Almodovar, X. Guan,
A. Kesarwani, L. Medina, E. Rowland and V. Moll
Scientia, Series A: Math. Sciences 29 (2019) 11-28.
The \(p\)-adic valuation of an integer \(x\) is the largest power of the
prime \(p\) that divides \(x\). It is denoted by \(\nu_p(x)\). This work describes properties
of the valuation \(\nu_2(n^2+a)\), with \(a\in\mathbb{N}\). A distinction of the behavior of these
valuations for \(a\equiv 7 \mod 8\) or not is presented.