OFFSET
0,1
COMMENTS
After n=22, is the frequency of 1 always > 2? Are terms only 1 or 2? - Bill McEachen, Dec 10 2024
The distinct terms of this sequence are only 1 and 2. The asymptotic densities of the occurrences of 1 and 2 are 2-sqrt(2) = 0.585... and sqrt(2)-1 = 0.414..., respectively. The asymptotic mean of this sequence is sqrt(2). - Amiram Eldar, Dec 11 2024
FORMULA
a(n) = 2 for n from A001110.
EXAMPLE
n = 0: in the interval [0, 1] are 2 triangular numbers {0, 1}, thus a(0) = 2.
n = 1: in the interval [1, 4] are 2 triangular numbers {1, 3}, thus a(1) = 2.
MATHEMATICA
s[n_] := Floor[(Sqrt[8*n+1]-1)/2]; a[n_] := s[(n + 1)^2] - s[n^2 - 1]; a[0] = 2; Array[a, 100, 0] (* Amiram Eldar, Dec 09 2024 *)
PROG
(PARI) a(n) = sum(k=n^2, (n+1)^2, ispolygonal(k, 3)); \\ Michel Marcus, Dec 09 2024
(Python)
from math import isqrt
def A378301(n): return -(isqrt(m:=n**2<<3)+1>>1)+(isqrt(m+(n+1<<4))+1>>1) # Chai Wah Wu, Dec 09 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, Nov 22 2024
EXTENSIONS
a(53) corrected by Michel Marcus, Dec 09 2024
STATUS
approved