A079813 n 0's followed by n 1's.
0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1
Offset: 1
Examples
x^2 + x^5 + x^6 + x^10 + x^11 + x^12 + x^17 + x^18 + x^19 + x^20 + ...
Links
- Boris Putievskiy, Transformations [Of] Integer Sequences And Pairing Functions, arXiv preprint arXiv:1212.2732 [math.CO], 2012.
Programs
-
Maple
A000194 := n->round(sqrt(n)):A079813 := n->(floor((n-1)/A000194(n))-A000194(n)+1);
-
Mathematica
Table[{Table[0, n], Table[1, n]}, {n, 11}] // Flatten (* or *) Rest@ CoefficientList[Series[(x/(1 - x)) Sum[x^k^2 (1 - x^k), {k, 12}], {x, 0, 120}], x] (* or *) Table[Floor[(n - 1)/#] - # + 1 &@ Round[Sqrt@ n], {n, 120}] (* Michael De Vlieger, Apr 13 2016 *) Table[Ceiling[Sqrt[n]] - Round[Sqrt[n]], {n, 1, 257}] (* Branko Curgus, Apr 25 2017 *)
-
PARI
{a(n) = if( n<1, 0, n--; m = sqrtint(n); n - m^2 < m)} /* Michael Somos, Nov 05 2011 */
-
Python
from math import isqrt def A079813(n): return int((m:=isqrt(n))**2!=n)-int(n-m*(m+1)>=1) # Chai Wah Wu, Jul 30 2022
Formula
G.f.: (x / (1 - x)) * (Sum_{k>0} x^k^2 * (1 - x^k)). - Michael Somos, Nov 05 2011
a(n) = floor((n-1)/A000194(n)) - A000194(n)+1, where A000194(n) = round(sqrt(n)). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 23 2003
a(n+1) = 1 - A118175(n). - Philippe Deléham, Jan 02 2012
a(n) = ceiling(sqrt(n)) - round(sqrt(n)). - Branko Curgus, Apr 26 2017
Comments