|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
FORMULA
|
Limit_{m->oo} (1/m) * Sum_{k=1..m} abs(a(k)) = 0.64111516... (A357016). (End)
|
|
EXAMPLE
|
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
|
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;
|
|
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
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|