OFFSET
1
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..100000
Jon Maiga, Computer-generated formulas for A359548, Sequence Machine.
FORMULA
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.
a(1) = 1, and for n > 1, a(n) = -Sum_{d|n, d<n} A053866(n/d) * a(d).
From Antti Karttunen, Nov 24 2023: (Start)
MATHEMATICA
f[p_, e_] := If[(p == 2 && e == 1) || (p > 2 && e == 2), -1, 0]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Jan 07 2023 *)
PROG
(PARI) A359548(n) = { my(f=factor(n)); prod(k=1, #f~, if(2==f[k, 1], -(1==f[k, 2]), -(2==f[k, 2]))); };
(Python)
from math import prod
from sympy import factorint
def A359548(n): return (0 if (m:=(~n & n-1).bit_length())>1 else (-1 if m==1 else 1))*prod(-1 if e==2 else 0 for e in factorint(n>>m).values()) # Chai Wah Wu, Jan 03 2024
CROSSREFS
KEYWORD
sign,mult
AUTHOR
Antti Karttunen, Jan 06 2023
STATUS
approved