This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A162512 #30 Jul 25 2024 04:42:22 %S A162512 1,-1,-1,2,-1,1,-1,-4,2,1,-1,-2,-1,1,1,8,-1,-2,-1,-2,1,1,-1,4,2,1,-4, %T A162512 -2,-1,-1,-1,-16,1,1,1,4,-1,1,1,4,-1,-1,-1,-2,-2,1,-1,-8,2,-2,1,-2,-1, %U A162512 4,1,4,1,1,-1,2,-1,1,-2,32,1,-1,-1,-2,1,-1,-1,-8,-1,1,-2,-2,1,-1,-1,-8,8,1 %N A162512 Dirichlet inverse of A162511. %C A162512 The absolute value of this sequence is A162510. %C A162512 The Moebius function (A008683) can be defined in terms of this sequence: A008683(n) is equal to a(n) if a(n) is odd and zero otherwise. %H A162512 Antti Karttunen, <a href="/A162512/b162512.txt">Table of n, a(n) for n = 1..10000</a> %H A162512 G. P. Michon, <a href="http://www.numericana.com/answer/numbers.htm#multiplicative">Multiplicative functions</a>. %F A162512 Multiplicative function with a(p^e)=-(-2)^(e-1) for any prime p and any positive exponent e. %F A162512 a(n) = n/2 when n is a power of 4 (A000302). %F A162512 a(n) = A008683(n) when n is a squarefree number (A005117). %F A162512 Dirichlet g.f.: Product_{p prime} ((p^s + 1)/(p^s + 2)). - _Amiram Eldar_, Oct 26 2023 %p A162512 A162512 := proc(n) %p A162512 local a,f; %p A162512 a := 1; %p A162512 for f in ifactors(n)[2] do %p A162512 a := -a*(-2)^(op(2,f)-1) ; %p A162512 end do: %p A162512 return a; %p A162512 end proc: %p A162512 seq(A162512(n),n=1..100) ; # _R. J. Mathar_, May 20 2017 %t A162512 b[n_] := (-1)^(PrimeOmega[n] - PrimeNu[n]); %t A162512 a[n_] := a[n] = If[n == 1, 1, -Sum[b[n/d] a[d], {d, Most@ Divisors[n]}]]; %t A162512 Array[a, 100] (* _Jean-François Alcover_, Feb 17 2020 *) %o A162512 (PARI) a(n) = my(f=factor(n)); for(i=1, #f~, f[i,1]=-(-2)^(f[i,2]-1); f[i,2]=1); factorback(f); \\ _Michel Marcus_, May 20 2017 %o A162512 (Python) %o A162512 from sympy import factorint %o A162512 from operator import mul %o A162512 def a(n): %o A162512 f=factorint(n) %o A162512 return 1 if n==1 else reduce(mul, [-(-2)**(f[i] - 1) for i in f]) # _Indranil Ghosh_, May 20 2017 %o A162512 (Scheme) (define (A162512 n) (if (= 1 n) n (* (- (expt -2 (- (A067029 n) 1))) (A162512 (A028234 n))))) ;; _Antti Karttunen_, May 20 2017, after the given multiplicative formula. %Y A162512 Cf. A005117, A008683, A067029, A076479, A162510, A162511. %K A162512 easy,mult,sign %O A162512 1,4 %A A162512 _Gerard P. Michon_, Jul 05 2009, Jul 06 2009