Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #21 Dec 09 2024 15:54:26
%S 1,2,3,4,6,7,9,10,11,13,14,16,17,18,20,21,23,24,25,27,28,30,31,33,34,
%T 35,37,38,40,41,42,44,45,47,48,50,51,52,54,55,57,58,59,61,62,64,65,66,
%U 68,69,71,72,74,75,76,78,79,81,82,83,85,86,88,89,91,92,93,95,96,98,99,100
%N Number of triangular numbers in interval [0, n^2].
%C Partial sums of A214856.
%H Alois P. Heinz, <a href="/A214857/b214857.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = floor((1 + sqrt(1+8*n^2))/2). - _Ralf Stephan_, Jan 30 2014
%e 0, 1, 3, 6 are in interval [0, 9], a(3) = 4.
%e 0, 1, 3, 6, 10, 15 are in interval [0, 16], a(4) = 6.
%t nn = 100; tri = Table[n (n + 1)/2, {n, 0, nn}]; Table[Count[tri, _?(# <= n^2 &)], {n, 0, Sqrt[tri[[-1]]]}] (* _T. D. Noe_, Mar 11 2013 *)
%t Table[Floor[(Sqrt[8*n^2+1]-1)/2]+1,{n,0,80}] (* _Harvey P. Dale_, Oct 14 2014 *)
%o (Python)
%o from math import isqrt
%o def A214857(n): return isqrt(n**2+1<<3)+1>>1 # _Chai Wah Wu_, Dec 09 2024
%Y Cf. A022846, A214848, A214856.
%K nonn,easy
%O 0,2
%A _Philippe Deléham_, Mar 09 2013