OFFSET
1,2
FORMULA
a(n) = n+m if n > m(m+1)(2m+1)/6 and a(n) = n+m-1 otherwise where m = floor((3n)^(1/3)).
a(n) = A074279(n)+n-1.
PROG
(Python)
from sympy import integer_nthroot
def A377721(n): return n+(m:=integer_nthroot(3*n, 3)[0])-(6*n<=m*(m+1)*((m<<1)+1))
CROSSREFS
KEYWORD
nonn
AUTHOR
Chai Wah Wu, Nov 04 2024
STATUS
approved