login
A242067
Number of triangular numbers between n^2 and n^3 (excluding the bounds).
1
0, 0, 1, 3, 5, 9, 12, 16, 21, 25, 31, 36, 42, 48, 54, 61, 68, 75, 83, 90, 98, 106, 115, 123, 132, 142, 150, 160, 170, 180, 190, 200, 211, 221, 232, 243, 254, 266, 277, 289, 301, 313, 326, 338, 351, 363, 376, 390, 402, 416, 429, 443, 456, 471, 485, 499, 514, 528, 543, 558
OFFSET
0,4
LINKS
EXAMPLE
There are 3 triangular numbers between 9 and 27, namely 10, 15, 21. So a(3)=3.
MAPLE
b:= n-> floor((sqrt(n*8+1)-1)/2):
a:= n-> `if`(n<2, 0, b(n^3-1) -b(n^2)):
seq(a(n), n=0..100); # Alois P. Heinz, Aug 14 2014
PROG
(Python)
for n in range(60):
sq=n*n
cb=n**3
s = t = 0
while 1:
tn = t*(t+1)/2
if tn>sq and tn<cb: s+=1
elif tn>=cb: break
t+=1
print str(s)+', ',
(PARI) a(n) = sum(i=n^2+1, n^3-1, ispolygonal(i, 3)); \\ Michel Marcus, Aug 14 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alex Ratushnyak, Aug 13 2014
STATUS
approved