login
a(n) = ceiling(sqrt(n))*floor(sqrt(n)).
4

%I #25 Dec 04 2022 08:32:17

%S 0,1,2,2,4,6,6,6,6,9,12,12,12,12,12,12,16,20,20,20,20,20,20,20,20,25,

%T 30,30,30,30,30,30,30,30,30,30,36,42,42,42,42,42,42,42,42,42,42,42,42,

%U 49,56,56,56,56,56,56,56,56,56,56,56,56,56,56,64,72,72,72,72,72,72,72

%N a(n) = ceiling(sqrt(n))*floor(sqrt(n)).

%C a(n) = n iff n is a square or a pronic (or heteromecic) number of form k(k+1). The sequence interleaves individual squares with 2k copies of each pronic.

%F a(n) = A003059(n)*A000196(n) = n - A038760(n).

%F a(A002620(n)) = A002620(n). - _Bernard Schott_, Nov 06 2022

%F Sum_{n>=1} (-1)^(n+1)/a(n) = Pi^2/12 (A072691). - _Amiram Eldar_, Dec 04 2022

%e a(31) = 30 since 6 and 5 are on either side of the square root of 31 and 6*5 = 30.

%t a[n_] := Ceiling[Sqrt[n]]*Floor[Sqrt[n]]; Array[a, 70, 0] (* _Amiram Eldar_, Dec 04 2022 *)

%o (Python)

%o from math import isqrt

%o def A038759(n): return m+n+k if (m:=(k:=isqrt(n))**2-n) else n # _Chai Wah Wu_, Jul 28 2022

%o (PARI) a(n) = my(r,s=sqrtint(n,&r)); if(r, n-r+s, n); \\ _Kevin Ryde_, Jul 30 2022

%Y Cf. A000196, A002378, A002620, A003059, A038760, A053187, A072691.

%K nonn,easy

%O 0,3

%A _Henry Bottomley_, May 03 2000