login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A197774
Suppose n has prime factorization n = p1^a1 * p2^a2 * ... * pk^ak. Then a(n) = (-1)^(n1 + n2 + ... + nk) if all the ai are ni^2 and a(n) = 0 otherwise.
3
1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1, 1, 1, 1, -1, 0, -1, 0, 1, 1, -1, 0, 0, 1, 0, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 0, -1, -1, -1, 0, 0, 1, -1, -1, 0, 0, 1, 0, -1, 0, 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 1, -1, -1, 0, -1, 1, 0, 0, 1, -1, -1, -1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 0, 1, 0, 1, 1, 1, 0, -1, 0, 0, 0, -1, -1, -1, 0, -1
OFFSET
1
COMMENTS
Differs from A219009 at n=32, 96, 160, 224, 243, 256, 352, ... - R. J. Mathar, May 28 2016
FORMULA
Multiplicative with a(p^e) = (-1)^sqrt(e) if e is a square, 0 otherwise. - Franklin T. Adams-Watters, Oct 18 2011
From Amiram Eldar, Nov 09 2023:
a(n) = (-1)^A001222(n) if n is in A197680 and 0 otherwise.
Limit_{m->oo} (1/m) * Sum_{k=1..m} abs(a(k)) = 0.64111516... (A357016). (End)
EXAMPLE
From Michael De Vlieger, Jul 24 2017: (Start)
a(5) = -1 since 5^1 has an exponent 1 that is a perfect square, thus (-1)^sqrt(1) = -1.
a(6) = 1 since 6 = 2^1 * 3^1; both exponents are perfect squares thus (-1)^sqrt(1) * (-1)^sqrt(1) = -1 * -1 = 1.
a(12) = 0 since 12 = 2^2 * 3^1. One exponent (1) is a perfect square but the other (2) is not, thus 0 * (-1)^sqrt(1) = 0.
(End)
MAPLE
A197774 := proc(n)
local a, pf, e ;
a := 1 ;
for pf in ifactors(n)[2] do
e := pf[2] ;
if issqr(e) then
a := a*(-1)^sqrt(e) ;
else
a := 0 ;
end if;
end do;
a;
end proc: # R. J. Mathar, May 28 2016
MATHEMATICA
Table[If[n == 1, 1, Apply[Times, FactorInteger[n] /. {p_, e_} /; p > 0 :> If[IntegerQ@ Sqrt@ e, (-1)^Sqrt@ e, 0]]], {n, 105}] (* Michael De Vlieger, Jul 24 2017 *)
PROG
(PARI) A197774(n) = { my(f=factor(n)[, 2]); prod(i=1, #f, if(issquare(f[i]), (-1)^sqrtint(f[i]), 0)); }; \\ Antti Karttunen, Jul 24 2017
CROSSREFS
KEYWORD
sign,easy,mult
AUTHOR
A. Neves, Oct 18 2011
EXTENSIONS
More terms from Antti Karttunen, Jul 24 2017
STATUS
approved