login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A064672
a(0) = 0, a(1) = 1; for a(n), n >= 2, write n = x^2 + y with y >= 0 as small as possible, then a(n) = a(x) + a(y).
2
0, 1, 2, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 6, 7, 2, 3, 4, 5, 4, 5, 6, 7, 6, 3, 4, 5, 6, 5, 6, 7, 8, 7, 6, 7, 4, 5, 6, 7, 6, 7, 8, 9, 8, 7, 8, 9, 10, 5, 6, 7, 8, 7, 8, 9, 10, 9, 8, 9, 10, 11, 10, 11, 4, 5, 6, 7, 6, 7, 8, 9, 8, 7, 8, 9, 10, 9, 10, 11, 6, 3, 4, 5, 6, 5, 6, 7, 8, 7, 6, 7, 8, 9, 8, 9, 10, 5, 6
OFFSET
0,3
COMMENTS
Because of the definition of a(n), a(n^2) = a(n) and more generally a(n^(2m)) = a(n), so the sequence recursively contains itself.
a(A064689(n)) = n and a(m) < n for m < A064689(n).
LINKS
FORMULA
For n > 1: a(n) = a(A000196(n)) + a(A053186(n)), a(0) = 0, a(1) = 1. [Reinhard Zumkeller, Apr 27 2012]
EXAMPLE
a(7) = 5 because 7 = 2^2 + 3, a(2) = 2 and a(3) = 3, giving 5
MATHEMATICA
a[0]=0; a[1]=1; a[n_] := a[n] = a[ Floor[ Sqrt[n] ] ] + a[ n - Floor[ Sqrt[n] ]^2 ]; Table[a[n], {n, 0, 98}] (* Jean-François Alcover, May 23 2012, after Reinhard Zumkeller *)
PROG
(Haskell)
a064672 n = a064672_list !! n
a064672_list = 0 : 1 : f (drop 2 a000196_list) 1 1 (tail a064672_list)
where f (r:rs) r' u (v:vs)
| r == r' = (u + v) : f rs r u vs
| r /= r' = u' : f rs r u' (tail a064672_list)
where u' = a064672 $ fromInteger r
-- Reinhard Zumkeller, Apr 27 2012
CROSSREFS
Cf. A064689.
Cf. A048760.
Sequence in context: A309236 A071933 A209802 * A138554 A063772 A209302
KEYWORD
nonn,easy,nice
AUTHOR
Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Oct 09 2001
STATUS
approved