login
n appears 3n+1 times.
6

%I #29 Nov 05 2024 12:18:24

%S 0,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,

%T 4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,

%U 6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8

%N n appears 3n+1 times.

%H Kevin Ryde, <a href="/A180447/b180447.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = floor((sqrt(24n+1)+1)/6).

%F a(n) = m+1 if 2n>m*(3m+5) and a(n) = m otherwise where m = floor(sqrt(2n/3)). For n>0, a(n) = k+1 if 2n>=(k+1)(3k+2) and a(n) = k otherwise where k = floor(sqrt(2(n-1)/3)). - _Chai Wah Wu_, Nov 04 2024

%e a(5) = floor((sqrt(24*5+1)+1)/6) = 2.

%t f[n_] := Floor[(Sqrt[24 n + 1] + 1)/6]; Array[f, 105, 0] (* _Robert G. Wilson v_, Sep 10 2010 *)

%o (Python) l = [floor((sqrt(24*n+1)+1)/6) for n in range(0,101)]

%o (Python)

%o from math import isqrt

%o def A180447(n): return (m:=isqrt((k:=n<<1)//3))+(k>m*(3*m+5)) # _Chai Wah Wu_, Nov 04 2024

%o (PARI) a(n) = (sqrtint(24*n+1)+1)\6; \\ _Kevin Ryde_, Apr 21 2021

%Y Cf. A000326 (indices of run starts), A180446.

%K easy,nonn,changed

%O 0,6

%A _William A. Tedeschi_, Sep 07 2010

%E More terms from _Robert G. Wilson v_, Sep 10 2010