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.

A378301 a(n) is the number of triangular numbers (A000217) in the interval [n^2, (n + 1)^2].

This page as a plain text file.
%I A378301 #29 Dec 12 2024 15:16:16
%S A378301 2,2,1,2,1,2,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,
%T A378301 2,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,2,1,1,2,1,
%U A378301 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
%N A378301 a(n) is the number of triangular numbers (A000217) in the interval [n^2, (n + 1)^2].
%C A378301 After n=22, is the frequency of 1 always > 2? Are terms only 1 or 2? - _Bill McEachen_, Dec 10 2024
%C A378301 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
%F A378301 a(n) = 2 for n from A001110.
%F A378301 a(n) = A003056((n+1)^2) - A003056(n^2-1) for n >= 1. - _Amiram Eldar_, Dec 09 2024
%F A378301 a(n) = A002024((n+1)^2+1) - A002024(n^2). - _Chai Wah Wu_, Dec 09 2024
%e A378301 n = 0: in the interval [0, 1] are 2 triangular numbers {0, 1}, thus a(0) = 2.
%e A378301 n = 1: in the interval [1, 4] are 2 triangular numbers {1, 3}, thus a(1) = 2.
%t A378301 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 *)
%o A378301 (PARI) a(n) = sum(k=n^2, (n+1)^2, ispolygonal(k,3)); \\ _Michel Marcus_, Dec 09 2024
%o A378301 (Python)
%o A378301 from math import isqrt
%o A378301 def A378301(n): return -(isqrt(m:=n**2<<3)+1>>1)+(isqrt(m+(n+1<<4))+1>>1) # _Chai Wah Wu_, Dec 09 2024
%Y A378301 Cf. A000217, A000290, A001110, A002024, A003056, A214856, A214857.
%K A378301 nonn
%O A378301 0,1
%A A378301 _Ctibor O. Zizka_, Nov 22 2024
%E A378301 a(53) corrected by _Michel Marcus_, Dec 09 2024