%I #34 Nov 14 2024 17:10:43
%S 1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,
%T 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
%N a(n) = 1 if n is either an odd squarefree number squared or twice such a number, otherwise 0.
%H Antti Karttunen, <a href="/A359549/b359549.txt">Table of n, a(n) for n = 1..100000</a>
%H Jon Maiga, <a href="http://sequencedb.net/s/A359549">Computer-generated formulas for A359549</a>, Sequence Machine.
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F Multiplicative with a(2^e) = 1 if e=1, a(2^e) = 0 if e > 1, and for odd primes p, a(p^e) = 1 if e=2, a(p^e) = 0 if e=1 or e>2.
%F a(n) = abs(A359548(n)) = A359548(n) mod 2.
%F a(n) = A046692(n) mod 2 = A323910(n) mod 2 = A327276(n) mod 2 = A327278(n) mod 2.
%t a[n_] := If[(e = IntegerExponent[n, 2]) < 2 && SquareFreeQ[Sqrt[n/2^e]], 1, 0] ; Array[a, 100] (* _Amiram Eldar_, Jan 07 2023 *)
%o (PARI) A359549(n) = { my(f=factor(n)); prod(k=1, #f~, if(2==f[k,1],(1==f[k,2]),(2==f[k,2]))); };
%o (Python)
%o from sympy import factorint
%o def A359549(n): return int((m:=(~n & n-1).bit_length())<2 and all(e==2 for e in factorint(n>>m).values())) # _Chai Wah Wu_, Jan 11 2023
%Y Characteristic function of A359580.
%Y Absolute values of A359548, and their parity.
%Y Also parity of A046692, A323910, A327276, A327278.
%Y Cf. A227291, A359818 (Dirichlet inverse).
%K nonn,mult,changed
%O 1
%A _Antti Karttunen_, Jan 06 2023