%I #29 Oct 15 2022 08:09:01
%S 1,2,0,0,2,0,0,0,0,4,0,0,2,0,0,0,2,0,0,0,0,0,0,0,2,4,0,0,2,0,0,0,0,4,
%T 0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,4,0,0,2,0,0,0,0,4,0,0,2,0,0,0,4,0,0,0,
%U 0,0,0,0,2,4,0,0,0,0,0,0,0,4,0,0,4,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0
%N Number of fixed points of GAMMA_0 (n) of type i.
%D Bruno Schoeneberg, Elliptic Modular Functions, Springer-Verlag, NY, 1974, p. 101.
%D Goro Shimura, Introduction to the Arithmetic Theory of Automorphic Functions, Princeton, 1971, see p. 25, Eq. (2).
%H Reinhard Zumkeller, <a href="/A000095/b000095.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) is multiplicative with a(2) = 2, a(2^e) = 0 if e>1, a(p^e) = 2 if p == 1 mod 4 and a(p^e) = 0 if p == 3 mod 4. - _Michael Somos_, Jul 15 2004
%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2/Pi = 0.636619... (A060294). - _Amiram Eldar_, Oct 15 2022
%e G.f. = x + 2*x^2 + 2*x^5 + 4*x^10 + 2*x^13 + 2*x^17 + 2*x^25 + 4*x^26 + 2*x^29 + ...
%p A000095 := proc(n) local b,d: if irem(n,4) = 0 then RETURN(0); else b := 1; for d from 2 to n do if irem(n,d) = 0 and isprime(d) then b := b*(1+legendre(-1,d)); fi; od; RETURN(b); fi: end;
%t A000095[ 1 ] = 1; A000095[ n_Integer ] := If[ Mod[ n, 4 ]==0, 0, Fold[ #1*(1+JacobiSymbol[ -1, #2 ])&, If[ EvenQ[ n ], 2, 1 ], Select[ First[ Transpose[ FactorInteger[ n ] ] ], OddQ ] ] ]
%t a[ n_] := If[ n < 1, 0, Times @@ (Which[# == 1, 1, # == 2, 2 Boole[#2 == 1], Mod[#, 4] == 1, 2, True, 0] & @@@ FactorInteger[n])]; (* _Michael Somos_, Nov 15 2015 *)
%o (PARI) {a(n) = my(t); if( n<=1 || n%4==0, n==1, t=1; fordiv(n, d, if( isprime(d), t *= (1 + kronecker(-1, d)))); t)}; /* _Michael Somos_, Jul 15 2004 */
%o (Haskell)
%o a000095 n = product $ zipWith f (a027748_row n) (a124010_row n) where
%o f 2 e = if e == 1 then 2 else 0
%o f p _ = if p `mod` 4 == 1 then 2 else 0
%o -- _Reinhard Zumkeller_, Mar 24 2012
%o (PARI) A000095(n)=n%3 && n%4 && n%7 && n%11 && return(prod(k=1,#n=factor(n)[,1],1+kronecker(-1,n[k]))) /* the n%4 is needed, the others only reduce execution time by 34% */ \\ _M. F. Hasler_, Mar 24 2012
%Y Cf. A027748, A060294, A124010, A000089.
%K nonn,easy,mult
%O 1,2
%A _N. J. A. Sloane_
%E Values a(1)-a(10^4) double checked by _M. F. Hasler_, Mar 24 2012