login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A023969 a(n) = round(sqrt(n)) - floor(sqrt(n)). 3

%I #28 Jun 22 2019 09:25:54

%S 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 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 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 a(n) = round(sqrt(n)) - floor(sqrt(n)).

%C First bit in fractional part of binary expansion of square root of n.

%H Chai Wah Wu, <a href="/A023969/b023969.txt">Table of n, a(n) for n = 0..10000</a>

%F Runs are 0^1, 0^2 1, 0^3 1^2, 0^4 1^3, ...

%F 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 a(n) = floor(2*sqrt(n)) - 2*floor(sqrt(n)). - _Mircea Merca_, Jan 31 2012

%F a(n) = A000194(n) - A000196(n) = floor(sqrt(n) + 1/2) - floor(sqrt(n)). - _Ridouane Oudra_, Jun 20 2019

%p seq(floor(2*sqrt(n))-2*floor(sqrt(n)),n=0..100); # _Ridouane Oudra_, Jun 20 2019

%t Array[ Function[ n, RealDigits[ N[ Power[ n, 1/2 ], 10 ], 2 ]// (#[ [ 1, #[ [ 2 ] ]+1 ] ])& ], 110 ]

%t Table[Round[Sqrt[n]]-Floor[Sqrt[n]],{n,0,120}] (* _Harvey P. Dale_, Jan 02 2018 *)

%o (PARI) a(n)=sqrtint(4*n)-2*sqrtint(n) \\ _Charles R Greathouse IV_, Jan 31 2012

%o (Python)

%o from gmpy2 import isqrt_rem

%o def A023969(n):

%o i, j = isqrt_rem(n)

%o return int(4*(j-i) >= 1) # _Chai Wah Wu_, Aug 16 2016

%Y Cf. A080343, A080344.

%K nonn

%O 0,1

%A _N. J. A. Sloane_, _Olivier GĂ©rard_

%E Revised by _N. J. A. Sloane_, Mar 20 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 05:56 EDT 2024. Contains 371964 sequences. (Running on oeis4.)