# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a354329 Showing 1-1 of 1 %I A354329 #44 Jul 15 2022 13:49:54 %S A354329 0,1,3,10,21,36,55,78,120,171,210,276,351,465,561,666,820,990,1128, %T A354329 1326,1540,1770,2016,2278,2628,2926,3240,3655,4095,4465,4950,5460, %U A354329 5995,6555,7140,7750,8385,9180,9870,10731,11476,12403,13203,14196,15225,16290,17205 %N A354329 Triangular number nearest to the sum of the first n positive triangular numbers. %H A354329 Wikipedia, Triangular number. %F A354329 a(n) = (t^2+t)/2, where t = floor(sqrt(n*(n+1)*(n+2)/3)). %e A354329 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. %t A354329 nterms=100;Table[t=Floor[Sqrt[n(n+1)(n+2)/3]];(t^2+t)/2,{n,0,nterms-1}] %o A354329 (PARI) %o A354329 a(n)=my(t=sqrtint(n*(n+1)*(n+2)/3));(t^2+t)/2; %o A354329 vector(100,n,a(n-1)) %o A354329 (Python) %o A354329 from math import isqrt %o A354329 def A354329(n): return (m:=isqrt(n*(n*(n + 3) + 2)//3))*(m+1)>>1 # _Chai Wah Wu_, Jul 15 2022 %Y A354329 Cf. A000217, A000292, A053616, A229118, A354330. %K A354329 nonn,easy %O A354329 0,3 %A A354329 _Paolo Xausa_, Jun 04 2022 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE