%I #16 Dec 04 2025 13:07:09
%S 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,
%T 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,
%U 1,0,0,0,1,1,0,1,1,0,0,0,0,1,1,1,0,0,1,0
%N a(n) = 1 if n is a number of the form x^2 + 2*y^2, and otherwise 0.
%C First differs from A342892 at n = 35.
%H Amiram Eldar, <a href="/A391183/b391183.txt">Table of n, a(n) for n = 0..10000</a>
%H Daniel Shanks and Larry P. Schmid, <a href="https://doi.org/10.1090/S0025-5718-1966-0210678-1">Variations on a theorem of Landau. Part I</a>, Mathematics of Computation, Vol. 20, No. 96 (1966), pp. 551-569.
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>.
%F a(n) = [A033715(n) > 0], where [ ] is the Iverson bracket.
%F a(A002479(n)) = 1 and a(A097700(n)) = 0.
%F Multiplicative with a(p^e) = 0 if p == 5 or 7 (mod 8) and e is odd, and a(p^e) = 1 otherwise.
%F Sum_{k=1..n} a(k) ~ b * n / sqrt(log(n)) + O(n/log(n)), where b = A391182 (Shanks and Schmid, 1966).
%t 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]
%o (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);
%o (Python)
%o from sympy import factorint
%o 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
%Y Characteristic function of A002479.
%Y Cf. A033715, A097700, A342892, A391182.
%Y Similar sequences: A229062, A353816.
%K nonn,mult,easy
%O 0
%A _Amiram Eldar_, Dec 02 2025