OFFSET
1,3
COMMENTS
The current sequence is, loosely, the inverse function of the 2*binomial(n,3) sequence A007290.
A007290 has alternative formulas, thus yielding alternative formulas for the current sequence.
The formula below was inspired by Sum_{i = 0..n-2} (i*(i+1)) = n*(n-1)*(n-2)/3 given in A007290.
By definition: A002378 = run lengths. - Reinhard Zumkeller, Jan 01 2013
a(n) is the number of distinct terms of A007290 < n. - Chai Wah Wu, Nov 14 2024
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
For c(n) = floor((3*n)^(1/3)), e(n) = n - (c(n)*(c(n)+1)*(c(n)+2))/3, explicit formula is a(n) = c(n) + sgn(abs(e(n)) + e(n)).
a(n) = floor(t + 1/(3*t)), where t = (3*(n - 1))^(1/3), for n > 1. - Ridouane Oudra, Oct 30 2023
EXAMPLE
For n = 21 the solution is found as the following: c(21) = 3, e(21) = 1, and finally a(21) = 4.
MATHEMATICA
Flatten[Array[Table[#, #(#+1)]&, 6]] (* Paolo Xausa, Dec 10 2023 *)
PROG
(Haskell)
a220104 n = a220104_list !! (n-1)
a220104_list = concatMap (\x -> take (a002378 x) $ repeat x) [1..]
-- Reinhard Zumkeller, Jan 01 2013
(Python)
from sympy import integer_nthroot
def A220104(n): return (m:=integer_nthroot(k:=3*n, 3)[0])+(k>m*(m+1)*(m+2)) # Chai Wah Wu, Nov 14 2024
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Can Atilgan and Murat Erşen Berberler (muratersenberberler(AT)gmail.com), Dec 05 2012
STATUS
approved