cp's OEIS Frontend

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.

A089003 Number of non-congruent solutions to x^2 - 2y^2 == 1 (mod n).

This page as a plain text file.
%I A089003 #39 Nov 21 2023 05:28:29
%S A089003 1,2,4,4,6,8,6,16,12,12,12,16,14,12,24,32,16,24,20,24,24,24,22,64,30,
%T A089003 28,36,24,30,48,30,64,48,32,36,48,38,40,56,96,40,48,44,48,72,44,46,
%U A089003 128,42,60,64,56,54,72,72,96,80,60,60,96,62,60,72,128,84,96,68,64,88,72
%N A089003 Number of non-congruent solutions to x^2 - 2y^2 == 1 (mod n).
%C A089003 Also, the number of non-congruent solutions to x^2 - 2y^2 == -1 (mod n). - _Andrew Howroyd_, Jul 16 2018
%C A089003 The comment above is based on the identity -(x^2 - 2y^2) = (x-2y)^2 - 2(x-y)^2. - _Jianing Song_, Jul 17 2018
%H A089003 Andrew Howroyd, <a href="/A089003/b089003.txt">Table of n, a(n) for n = 1..10000</a>
%H A089003 László Tóth, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL17/Toth/toth12.html">Counting Solutions of Quadratic Congruences in Several Variables Revisited</a>, J. Int. Seq. 17 (2014), Article 14.11.6.
%F A089003 Multiplicative with a(2^e) = 2^e for e <= 2, a(2^e) = 2^(e+1) for e > 2, a(p^e) = (p-1)*p^(e-1) for p == +-1 (mod 8), a(p^e) = (p+1)*p^(e-1) for p == +-3 (mod 8). - _Andrew Howroyd_, Jul 15 2018
%F A089003 Sum_{k=1..n} a(k) ~ c * n^2, where c = 9/(16*A328895) = 0.644804064282100795... . - _Amiram Eldar_, Nov 21 2023
%t A089003 a[1]=1; a[n_]:=Length@Rest@Union@Flatten@Table[If[Mod[i^2 - 2 j^2, n]==1, i+I j, 0], {i, 0, n-1}, {j, 0, n-1}]; Table[a[n], {n, 1, 80}] (* _Vincenzo Librandi_, Jul 16 2018 *)
%t A089003 f[2, e_] := If[e < 3, 2^e, 2^(e+1)]; f[p_, e_] := If[MemberQ[{1, 7}, Mod[p, 8]], (p - 1), (p + 1)] * p^(e - 1); a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* _Amiram Eldar_, Sep 11 2020 *)
%o A089003 (PARI) a(n)={my(v=vector(n)); for(i=0, n-1, v[i^2%n + 1]++); sum(i=0, n-1, v[i+1]*v[(2*i+1)%n + 1])} \\ _Andrew Howroyd_, Jul 09 2018
%o A089003 (PARI) a(n)={my(f=factor(n)); prod(i=1, #f~, my(p=f[i,1], e=f[i,2]); if(p==2, 2^e*if(e>2,2,1), p^(e-1)*if(abs(p%8-4)==1, p+1, p-1)))} \\ _Andrew Howroyd_, Jul 09 2018
%o A089003 (Magma) [n eq 1 select 1 else #[x: x in [1..n], y in [1..n] | (x^2-2*y^2) mod n eq 1]: n in [1..80]]; // _Vincenzo Librandi_, Jul 16 2018
%Y A089003 Cf. A088964, A088965, A089002, A062570, A328895.
%K A089003 mult,nonn,easy
%O A089003 1,2
%A A089003 Yuval Dekel (dekelyuval(AT)hotmail.com), Nov 02 2003