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.

A049240 Smallest nonnegative value taken on by x^2 - n*y^2 for an infinite number of integer pairs (x, y).

Original entry on oeis.org

0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Keywords

Comments

Encodes to 1,2,1,4,1,6,1,8,1,10,...: unsigned version of A009531. - Paul Barry, Oct 12 2005
Parity of inverse Moebius transform of Jacobsthal numbers J(k) less J(n). - Paul Barry, Oct 12 2005

Crossrefs

Characteristic function of A000037 (the nonsquares).

Programs

  • Magma
    [Floor((1 + Ceiling(Sqrt(n)) - Floor(Sqrt(n)))/2) : n in [1..100]]; // Wesley Ivan Hurt, Sep 27 2014
    
  • Maple
    A049240:=n->`if`(issqr(n),0,1): seq(A049240(n), n=1..100); # Wesley Ivan Hurt, Sep 27 2014
  • Mathematica
    Differences[Table[n - Ceiling[Sqrt[n]], {n, 105}]] (* Arkadiusz Wesolowski, Oct 30 2012 *)
    Table[Floor[(1 + Ceiling[Sqrt[n]] - Floor[Sqrt[n]])/2], {n, 70}] (* Wesley Ivan Hurt, Sep 27 2014 *)
  • Python
    from math import isqrt
    def A049240(n): return int(isqrt(n)**2!=n) # Chai Wah Wu, Jun 14 2022

Formula

a(n) = 0 if n is square, 1 otherwise.
a(n) = (A001045(n) - Sum_{k|n} A001045(k)) mod 2. - Paul Barry, Oct 12 2005
a(n) = 1 - A010052(n). - R. J. Mathar, Jul 04 2009
a(n) = floor(1+ceiling(sqrt(n))-floor(sqrt((n)))/2). - Wesley Ivan Hurt, Sep 27 2014
G.f.: (1+x)/(2-2*x) - (1/2)*theta_3(0,x) where theta_3 is a Jacobi theta function. - Robert Israel, Oct 02 2014