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.

A023969 a(n) = round(sqrt(n)) - floor(sqrt(n)).

This page as a plain text file.
%I A023969 #28 Jun 22 2019 09:25:54
%S A023969 0,0,0,1,0,0,0,1,1,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,
%T A023969 1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,
%U A023969 0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0
%N A023969 a(n) = round(sqrt(n)) - floor(sqrt(n)).
%C A023969 First bit in fractional part of binary expansion of square root of n.
%H A023969 Chai Wah Wu, <a href="/A023969/b023969.txt">Table of n, a(n) for n = 0..10000</a>
%F A023969 Runs are 0^1, 0^2 1, 0^3 1^2, 0^4 1^3, ...
%F A023969 a(n) = 1 iff n >= 3 and n is in the interval [k*(k+1) + 1, ..., k*(k+1) + k] for some k >= 1.
%F A023969 a(n) = floor(2*sqrt(n)) - 2*floor(sqrt(n)). - _Mircea Merca_, Jan 31 2012
%F A023969 a(n) = A000194(n) - A000196(n) = floor(sqrt(n) + 1/2) - floor(sqrt(n)). - _Ridouane Oudra_, Jun 20 2019
%p A023969 seq(floor(2*sqrt(n))-2*floor(sqrt(n)),n=0..100); # _Ridouane Oudra_, Jun 20 2019
%t A023969 Array[ Function[ n, RealDigits[ N[ Power[ n, 1/2 ], 10 ], 2 ]// (#[ [ 1, #[ [ 2 ] ]+1 ] ])& ], 110 ]
%t A023969 Table[Round[Sqrt[n]]-Floor[Sqrt[n]],{n,0,120}] (* _Harvey P. Dale_, Jan 02 2018 *)
%o A023969 (PARI) a(n)=sqrtint(4*n)-2*sqrtint(n) \\ _Charles R Greathouse IV_, Jan 31 2012
%o A023969 (Python)
%o A023969 from gmpy2 import isqrt_rem
%o A023969 def A023969(n):
%o A023969     i, j = isqrt_rem(n)
%o A023969     return int(4*(j-i) >= 1) # _Chai Wah Wu_, Aug 16 2016
%Y A023969 Cf. A080343, A080344.
%K A023969 nonn
%O A023969 0,1
%A A023969 _N. J. A. Sloane_, _Olivier Gérard_
%E A023969 Revised by _N. J. A. Sloane_, Mar 20 2003