login
a(n) = 2*a(n-1) - a(n-3) + a(floor(n/2)) + a(floor(n/3)) + ... + a(floor(n/n)), where a(0) = 1, a(1) = 2, a(2) = 3.
3

%I #10 Mar 31 2021 19:19:37

%S 1,2,3,9,23,52,113,223,431,794,1442,2532,4433,7589,12924,21730,36411,

%T 60440,100125,164816,270863,443390,724846,1181713,1925113,3130488,

%U 5087530,8258585,13400782,21728136,35221342,57065559,92441545,149701409,242400952,392424193

%N a(n) = 2*a(n-1) - a(n-3) + a(floor(n/2)) + a(floor(n/3)) + ... + a(floor(n/n)), where a(0) = 1, a(1) = 2, a(2) = 3.

%C a(n)/a(n-1) -> (1 + sqrt(5))/2, the golden ratio (A001622), so that (a(n)) has the growth rate of the Fibonacci numbers (A000045). See A298338 for a guide to related sequences.

%H Clark Kimberling, <a href="/A298407/b298407.txt">Table of n, a(n) for n = 0..1000</a>

%t a[0] = 1; a[1] = 2; a[2] = 3;

%t a[n_] := a[n] = 2*a[n - 1] - a[n - 3] + Sum[a[Floor[n/k]], {k, 2, n}];

%t Table[a[n], {n, 0, 90}] (* A298407 *)

%o (Python)

%o from functools import lru_cache

%o @lru_cache(maxsize=None)

%o def A298407(n):

%o if n <= 2:

%o return n+1

%o c, j = 2*A298407(n-1)-A298407(n-3), 2

%o k1 = n//j

%o while k1 > 1:

%o j2 = n//k1 + 1

%o c += (j2-j)*A298407(k1)

%o j, k1 = j2, n//j2

%o return c+2*(n-j+1) # _Chai Wah Wu_, Mar 31 2021

%Y Cf. A001622, A000045, A298338, A298406.

%K nonn,easy

%O 0,2

%A _Clark Kimberling_, Feb 10 2018