login
A049240
Smallest nonnegative value taken on by x^2 - n*y^2 for an infinite number of integer pairs (x, y).
13
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,1
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
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
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 *)
PROG
(Magma) [Floor((1 + Ceiling(Sqrt(n)) - Floor(Sqrt(n)))/2) : n in [1..100]]; // 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
CROSSREFS
Characteristic function of A000037 (the nonsquares).
Sequence in context: A285418 A344617 A068717 * A285978 A138712 A029693
KEYWORD
nonn,easy
STATUS
approved