login
A391183
a(n) = 1 if n is a number of the form x^2 + 2*y^2, and otherwise 0.
7
1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0
OFFSET
0
COMMENTS
First differs from A342892 at n = 35.
LINKS
Daniel Shanks and Larry P. Schmid, Variations on a theorem of Landau. Part I, Mathematics of Computation, Vol. 20, No. 96 (1966), pp. 551-569.
FORMULA
a(n) = [A033715(n) > 0], where [ ] is the Iverson bracket.
a(A002479(n)) = 1 and a(A097700(n)) = 0.
Multiplicative with a(p^e) = 0 if p == 5 or 7 (mod 8) and e is odd, and a(p^e) = 1 otherwise.
Sum_{k=1..n} a(k) ~ b * n / sqrt(log(n)) + O(n/log(n)), where b = A391182 (Shanks and Schmid, 1966).
MATHEMATICA
f[p_, e_] := If[OddQ[e] && Mod[p, 8] > 4, 0, 1]; a[0] = a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100, 0]
PROG
(PARI) a(n) = if(n < 2, 1, my(f = factor(n)); for(i = 1, #f~, if(f[i, 2] % 2 && f[i, 1] % 8 > 4, return(0))); 1);
(Python)
from sympy import factorint
def A391183(n): return int(any(e&1 and p&7>=5 for p, e in factorint(n).items()))^1 # Chai Wah Wu, Dec 04 2025
CROSSREFS
Characteristic function of A002479.
Similar sequences: A229062, A353816.
Sequence in context: A114592 A344864 A140653 * A342892 A071036 A071038
KEYWORD
nonn,mult,easy
AUTHOR
Amiram Eldar, Dec 02 2025
STATUS
approved