A092205 Number of units in the imaginary quadratic field Q(sqrt(-n)).
4, 2, 6, 4, 2, 2, 2, 2, 4, 2, 2, 6, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 6, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2
Offset: 1
Examples
For n=1, the units are +/-1, +/-i, so a(1) = 4. For n=3, the units are +/-1, +/-w, +/-w^2, where w is a cube root of unity, so a(3) = 6. [Corrected by _Jonathan Sondow_, Jan 29 2014]
Links
- Nathaniel Johnston, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Mathematics, Unit
Programs
-
Maple
A092205 := proc(n) if(type(sqrt(n),integer))then return 4: elif(n mod 3 = 0 and type(sqrt(n/3),integer))then return 6: else return 2: fi: end: seq(A092205(n),n=1..105); # Nathaniel Johnston, Jun 26 2011
-
Mathematica
a[n_] := Which[ IntegerQ[ Sqrt[n] ], 4, Mod[n, 3] == 0 && IntegerQ[ Sqrt[n/3] ], 6, True, 2]; Table[a[n], {n, 1, 105}] (* Jean-François Alcover, Oct 30 2012, after Nathaniel Johnston *)
-
PARI
a(n)=if(issquare(n),return(4));if(n%3==0&&issquare(n/3),6,2) \\ Charles R Greathouse IV, Oct 30 2012
Comments