A038759 a(n) = ceiling(sqrt(n))*floor(sqrt(n)).
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, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 36, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 49, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 64, 72, 72, 72, 72, 72, 72, 72
Offset: 0
Examples
a(31) = 30 since 6 and 5 are on either side of the square root of 31 and 6*5 = 30.
Programs
-
Mathematica
a[n_] := Ceiling[Sqrt[n]]*Floor[Sqrt[n]]; Array[a, 70, 0] (* Amiram Eldar, Dec 04 2022 *)
-
PARI
a(n) = my(r,s=sqrtint(n,&r)); if(r, n-r+s, n); \\ Kevin Ryde, Jul 30 2022
-
Python
from math import isqrt def A038759(n): return m+n+k if (m:=(k:=isqrt(n))**2-n) else n # Chai Wah Wu, Jul 28 2022
Formula
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi^2/12 (A072691). - Amiram Eldar, Dec 04 2022
Comments