login
Number of solutions to x^2 == 1 (mod n) in Z[i]/nZ[i].
6

%I #38 Sep 19 2020 10:30:38

%S 1,2,2,4,4,4,2,8,2,8,2,8,4,4,8,8,4,4,2,16,4,4,2,16,4,8,2,8,4,16,2,8,4,

%T 8,8,8,4,4,8,32,4,8,2,8,8,4,2,16,2,8,8,16,4,4,8,16,4,8,2,32,4,4,4,8,

%U 16,8,2,16,4,16,2,16,4,8,8,8,4,16,2,32,2,8

%N Number of solutions to x^2 == 1 (mod n) in Z[i]/nZ[i].

%C Number of non-congruent solutions of x^2 + y^2 -1 == 2xy == 0 (mod n).

%C This sequence combines A329586 (number of representative solutions of a^2 - (b^2 + 1) == 0 (mod m) and 2*a*b == 0 (mod m) with a*b = 0), and those from A329589 (number of representative solutions of these two congruences but with a*b not 0). - _Wolfdieter Lang_, Dec 14 2019

%C In A226746 the positive n numbers with more than two representative solutions of the congruence z^2 = +1 (mod n) are given. This is therefore a proper subsequence of the present one. - _Wolfdieter Lang_, Dec 14 2019

%H Eric M. Schmidt, <a href="/A227091/b227091.txt">Table of n, a(n) for n = 1..1000</a>

%F Multiplicative with a(2^e) = 2^min(e, 3); a(p^e) = 4 for p == 1 (mod 4); a(p^e) = 2 for p == 3 (mod 4). - _Eric M. Schmidt_, Jul 09 2013

%e a(4) = 4 because in Z[i]/4Z[i] the equation x^2==1 (mod 4) has 4 solutions: 1, 1+2i, 3 and 3+2i.

%p a:= n-> mul(`if`(i[1]=2, 2^min(i[2], 3), `if`(

%p irem(i[1], 4)=1, 4, 2)), i=ifactors(n)[2]):

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Feb 07 2020

%t h[n_] := Flatten[Table[a + b I, {a, 0, n - 1}, {b, 0, n - 1}]]; a[1] = 1; a[n_] := Length@Select[h[n], Mod[#^2, n] == 1 &]; Table[a[n], {n, 2, 44}]

%t f[2, e_] := 2^Min[e, 3]; f[p_, e_] := If[Mod[p, 4] == 1, 4, 2]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* _Amiram Eldar_, Sep 19 2020 *)

%o (Sage) def A227091(n) : return prod([4,2^min(m,3),2][p%4-1] for (p,m) in factor(n)) # _Eric M. Schmidt_, Jul 09 2013

%o (PARI) a(n)=my(o=valuation(n,2),f=factor(n>>o)[,1]); prod(i=1,#f, if(f[i]%4==1, 4, 2))<<min(o,3) \\ _Charles R Greathouse IV_, Dec 13 2013

%Y Cf. A060594, A226746, A329586, A329589.

%K nonn,mult,easy

%O 1,2

%A _José María Grau Ribas_, Jun 30 2013