Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #12 Sep 05 2023 01:43:26
%S 1,0,0,1,0,0,0,-2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,-2,0,0,0,0,0,0,
%T 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
%U 0,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,-2
%N Multiplicative with a(p^2) = 1, a(p^3) = -2 and a(p^e) = 0 when e = 1 or e > 3.
%C Used for computing A208133.
%H Antti Karttunen, <a href="/A300828/b300828.txt">Table of n, a(n) for n = 1..65537</a>
%e For n = 216 = 2^3 * 3^3, a(2^3) * a(3^3) = -2 * -2 = 4.
%t f[p_, e_] := Switch[e, 2, 1, 3, -2, _, 0]; a[n_] := Times @@ f @@@ FactorInteger[n]; a[1] = 1; Array[a, 100] (* _Amiram Eldar_, Sep 05 2023 *)
%o (PARI) A300828(n) = { if(1==n, return(1)); my(val=1, v=factor(n), d=matsize(v)[1]); for(i=1,d, if(v[i,2] < 2 || v[i,2] > 3, return(0)); if (v[i,2] == 3, val *= -2)); return(val); }; \\ _R. J. Mathar_, _Antti Karttunen_, Mar 21 2018
%o (Scheme, with memoization-macro definec)
%o (definec (A300828 n) (if (= 1 n) n (* (case (A067029 n) ((2) 1) ((3) -2) (else 0)) (A300828 (A028234 n)))))
%Y Cf. A208133.
%K sign,easy,mult
%O 1,8
%A _Antti Karttunen_, Mar 21 2018