OFFSET
1
COMMENTS
Differs from A219009 at n=32, 96, 160, 224, 243, 256, 352, ... - R. J. Mathar, May 28 2016
LINKS
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:
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