cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A214856 Number of triangular numbers in interval ](n-1)^2, n^2] for n>0, a(0)=1.

Original entry on oeis.org

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

Views

Author

Philippe Deléham, Mar 08 2013

Keywords

Examples

			10, 15 are in interval ]9, 16] , a(4) = 2.
		

Crossrefs

Programs

  • 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