login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 60th year, we have over 367,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A354329 Triangular number nearest to the sum of the first n positive triangular numbers. 3
0, 1, 3, 10, 21, 36, 55, 78, 120, 171, 210, 276, 351, 465, 561, 666, 820, 990, 1128, 1326, 1540, 1770, 2016, 2278, 2628, 2926, 3240, 3655, 4095, 4465, 4950, 5460, 5995, 6555, 7140, 7750, 8385, 9180, 9870, 10731, 11476, 12403, 13203, 14196, 15225, 16290, 17205 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
Wikipedia, Triangular number.
FORMULA
a(n) = (t^2+t)/2, where t = floor(sqrt(n*(n+1)*(n+2)/3)).
EXAMPLE
a(4) = 21 because the sum of the first 4 positive triangular numbers is 1 + 3 + 6 + 10 = 20, and the nearest triangular number is 21.
MATHEMATICA
nterms=100; Table[t=Floor[Sqrt[n(n+1)(n+2)/3]]; (t^2+t)/2, {n, 0, nterms-1}]
PROG
(PARI)
a(n)=my(t=sqrtint(n*(n+1)*(n+2)/3)); (t^2+t)/2;
vector(100, n, a(n-1))
(Python)
from math import isqrt
def A354329(n): return (m:=isqrt(n*(n*(n + 3) + 2)//3))*(m+1)>>1 # Chai Wah Wu, Jul 15 2022
CROSSREFS
Sequence in context: A194141 A281153 A014105 * A146012 A027917 A038347
KEYWORD
nonn,easy
AUTHOR
Paolo Xausa, Jun 04 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 4 01:51 EST 2023. Contains 367541 sequences. (Running on oeis4.)