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.

Showing 1-1 of 1 results.

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

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Keywords

Comments

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

Crossrefs

Programs

  • Maple
    seq(floor(2*sqrt(n))-2*floor(sqrt(n)),n=0..100); # Ridouane Oudra, Jun 20 2019
  • Mathematica
    Array[ Function[ n, RealDigits[ N[ Power[ n, 1/2 ], 10 ], 2 ]// (#[ [ 1, #[ [ 2 ] ]+1 ] ])& ], 110 ]
    Table[Round[Sqrt[n]]-Floor[Sqrt[n]],{n,0,120}] (* Harvey P. Dale, Jan 02 2018 *)
  • PARI
    a(n)=sqrtint(4*n)-2*sqrtint(n) \\ Charles R Greathouse IV, Jan 31 2012
    
  • Python
    from gmpy2 import isqrt_rem
    def A023969(n):
        i, j = isqrt_rem(n)
        return int(4*(j-i) >= 1) # Chai Wah Wu, Aug 16 2016

Formula

Runs are 0^1, 0^2 1, 0^3 1^2, 0^4 1^3, ...
a(n) = 1 iff n >= 3 and n is in the interval [k*(k+1) + 1, ..., k*(k+1) + k] for some k >= 1.
a(n) = floor(2*sqrt(n)) - 2*floor(sqrt(n)). - Mircea Merca, Jan 31 2012
a(n) = A000194(n) - A000196(n) = floor(sqrt(n) + 1/2) - floor(sqrt(n)). - Ridouane Oudra, Jun 20 2019

Extensions

Revised by N. J. A. Sloane, Mar 20 2003
Showing 1-1 of 1 results.