login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A000091 Multiplicative with a(2^e) = 2 for k >= 1; a(3) = 2, a(3^e) = 0 for k >= 2; a(p^e) = 0 if p > 3 and p == -1 (mod 3); a(p^e) = 2 if p > 3 and p == 1 (mod 3). 3

%I #21 Sep 18 2018 02:14:44

%S 1,2,2,2,0,4,2,2,0,0,0,4,2,4,0,2,0,0,2,0,4,0,0,4,0,4,0,4,0,0,2,2,0,0,

%T 0,0,2,4,4,0,0,8,2,0,0,0,0,4,2,0,0,4,0,0,0,4,4,0,0,0,2,4,0,2,0,0,2,0,

%U 0,0,0,0,2,4,0,4,0,8,2,0,0,0,0,8,0,4,0,0,0,0,4,0,4,0,0,4,2,4,0,0,0,0,2,4,0

%N Multiplicative with a(2^e) = 2 for k >= 1; a(3) = 2, a(3^e) = 0 for k >= 2; a(p^e) = 0 if p > 3 and p == -1 (mod 3); a(p^e) = 2 if p > 3 and p == 1 (mod 3).

%H Christian G. Bower, <a href="/A000091/b000091.txt">Table of n, a(n) for n = 1..2000</a>

%p A000091 := proc(n) local b,d,nt,c; if n = 1 then RETURN(1); fi; c := 1; if n mod 2 = 0 then c := c*2; fi; if n mod 3 = 0 then c := c*2; fi; nt := n; while nt mod 2 = 0 do nt := nt/2; od; while nt mod 3 = 0 do nt := nt/3; od; if irem(n,9) = 0 then RETURN(0); fi; b := 1; for d from 3 to nt do if irem(nt,d) = 0 and isprime(d) then b := b*(1+legendre(-3,d)); fi; od; RETURN(b*c); end;

%t a[1] = 1; a[n_] := Block[{b, d, nt, c = 1}, If[Mod[n, 2] == 0, c = c*2]; If[Mod[n, 3] == 0, c = c*2]; nt = n; While[ Mod[nt, 2] == 0, nt = nt/2]; While[ Mod[nt, 3] == 0, nt = nt/3]; If[Mod[n, 9] == 0, Return[0]]; b = 1; For[d = 3, d <= nt, d++, If[Mod[nt, d] == 0 && PrimeQ[d], b = b*(1+JacobiSymbol[-3, d])]]; Return[b*c]]; Table[a[n], {n, 1, 105}] (* _Jean-François Alcover_, Feb 06 2012, after Maple *)

%K nonn,easy,mult

%O 1,2

%A _N. J. A. Sloane_

%E Description corrected Mar 02 2004. (The old description defined A000086, not this sequence.)

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 10:00 EDT 2024. Contains 371935 sequences. (Running on oeis4.)