login
A214856
Number of triangular numbers in interval ](n-1)^2, n^2] for n>0, a(0)=1.
3
1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1
OFFSET
0,5
LINKS
EXAMPLE
10, 15 are in interval ]9, 16] , a(4) = 2.
PROG
(PARI) a(n) = if (n, sum(i=(n-1)^2+1, n^2, ispolygonal(i, 3)), 1); \\ Michel Marcus, Nov 12 2022
(Python)
from math import isqrt
def A214856(n): return (isqrt((m:=n**2<<3)+8)+1>>1)-(isqrt(m-(n-1<<4))+1>>1) if n else 1 # Chai Wah Wu, Dec 09 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Philippe Deléham, Mar 08 2013
STATUS
approved