A259361 n occurs 2n+2 times.
0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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, 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, 8, 8, 8, 8, 8
Offset: 0
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Programs
-
Haskell
a259361 = floor . subtract (1 / 2) . sqrt . (+ 1 / 4) . fromIntegral a259361_list = concat xss where xss = iterate (\(xs@(x:_)) -> map (+ 1) (x : x : xs)) [0, 0] -- Reinhard Zumkeller, Jul 09 2015
-
Magma
[Floor((-1+Sqrt(1+4*n))/2): n in [0..85]]; // Vincenzo Librandi, Oct 30 2016
-
Mathematica
Flatten[Table[PadLeft[{}, 2n + 2, n], {n, 0, 8}]] (* Alonso del Arte, Jun 30 2015 *) Table[Floor[(-1 + Sqrt[1 + 4 n])/2], {n, 0, 120}] (* Michael De Vlieger, Oct 31 2016 *)
-
Python
from math import isqrt def A259361(n): return (m:=isqrt(n-1)-1)+(n-1>m*(m+3)) if n else 0 # Chai Wah Wu, Nov 07 2024
Formula
a(n) = A000194(n+1)-1.
a(n) = floor((-1 + sqrt(1+4*n))/2). See the first comment above. - Wolfdieter Lang, Oct 29 2016
Comments