OFFSET
1,3
COMMENTS
Conjecture 1: Numbers n such that a(n) = 0 is A009003.
Conjecture 2: Numbers n such that a(n) = 1 is A000079.
From Chai Wah Wu, Jul 06-07 2024: (Start)
a(n) = sum_d A374367(d) where d ranges over all odd squarefree divisors of n.
a(n) = a(A000265(n)).
a(2^k) = 1 as 1 is the only odd squarefree divisor of 2^k.
a((4*m+1)^k) = 0 if 4*m+1 is prime and k > 0 since the only odd squarefree divisors of (4*m+1)^k is 1 and 4*m+1 and a(1) = 1 and a(4*m+1)= -1.
a((4*m+3)^k) = 2 if 4*m+1 is prime and k > 0 since the only odd squarefree divisors of (4*m+3)^k is 1 and 4*m+3 and a(1) = 1 and a(4*m+3)= 1.
Theorem: a(n) is multiplicative.
Proof: Im(i^k) = 1 if k == 1 (mod 4), Im(i^k) = 0 if k == 0 or 2 (mod 4) and Im(i^k) = -1 if k == 3 (mod 4). Noting that 3*3 == 1 (mod 4), it is easy to verify that Im(i^k) is multiplicative. Since a(n) = sum_{d|n} mu(d)*Im(i^d) and mu is multiplicative, a proof similar to the proof of the multiplicative property of the Dirichlet convolution shows that a(n) is also multiplicative.
This implies that a(n) = 0 if n has a prime factor of the form 4*m+1 and a(n) = 2^(number of prime factors of n of the form 4*m+3) otherwise.
Since A009003 are exactly the numbers that contains a prime factor of the form 4*m+1, this can be written more succinctly as a(n) = 0 if n is in A009003 and a(n) = 2^A005091(n) otherwise.
This means that Conjectures 1 and 2 above are true.
(End)
FORMULA
a(n) = Im(Sum_{k=1..n} [k|n]*A008683(k)*(i^k)).
MATHEMATICA
nn = 86; ParallelTable[Im[Sum[If[Mod[n, k] == 0, 1, 0]*(I^k)*MoebiusMu[k], {k, 1, n}]], {n, 1, nn}]
PROG
(Python)
from sympy import mobius, divisors
def A374366(n): return sum(-mobius(d) if d&2 else mobius(d) for d in divisors(n>>(~n & n-1).bit_length(), generator=True)) # Chai Wah Wu, Jul 06 2024
(Python)
from sympy import primefactors
def A374366(n): # based on multiplicative property of a(n)
a = 0
for p in primefactors(n>>(~n & n-1).bit_length()):
if p&2:
a += 1
else:
return 0
return 1<<a # Chai Wah Wu, Jul 07 2024
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
Mats Granvik, Jul 06 2024
STATUS
approved