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.

A087780 Number of non-congruent solutions to x^2 == 2 mod n.

This page as a plain text file.
%I A087780 #18 Nov 21 2023 05:23:59
%S A087780 1,1,0,0,0,0,2,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,2,
%T A087780 0,0,0,0,0,0,2,0,0,0,0,2,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,
%U A087780 0,0,2,0,2,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,2,0,0,0,0,2,0,0,2,2,0,0,0,0,2,0,0
%N A087780 Number of non-congruent solutions to x^2 == 2 mod n.
%H A087780 Eric M. Schmidt, <a href="/A087780/b087780.txt">Table of n, a(n) for n = 1..10000</a>
%F A087780 Multiplicative with a(p^m) = 2 for p == 1, 7 (mod 8); a(p^m) = 0 for p == 3, 5 (mod 8); a(2^1) = 1; a(2^m) = 0 for m > 1. - _Eric M. Schmidt_, Apr 20 2013
%F A087780 Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = log(sqrt(2)+1)/(sqrt(2)*zeta(2)) = A196525/A013661 = 0.37887551404073012021... . - _Amiram Eldar_, Nov 21 2023
%t A087780 f[2, e_] := Boole[e == 1]; f[p_, e_] := If[MemberQ[{1, 7}, Mod[p, 8]], 2, 0]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* _Amiram Eldar_, Sep 19 2020 *)
%o A087780 (Sage)
%o A087780 def A087780(n) :
%o A087780     res = 1
%o A087780     for (p, m) in factor(n) :
%o A087780         if p % 8 in [1, 7] : res *= 2
%o A087780         elif not (p==2 and m==1) : return 0
%o A087780     return res
%o A087780 # _Eric M. Schmidt_, Apr 20 2013
%o A087780 (PARI) a(n) = {my(f = factor(n)); prod(i = 1, #f~, if(f[i,1] == 2, (f[i,2] == 1), if(f[i,1]%8 == 1 || f[i,1]%8 == 7, 2, 0)));} \\ _Amiram Eldar_, Nov 21 2023
%Y A087780 Cf. A038873, A057126, A060594.
%Y A087780 Cf. A013661, A196525.
%K A087780 mult,nonn,easy
%O A087780 1,7
%A A087780 Yuval Dekel (dekelyuval(AT)hotmail.com), Oct 06 2003
%E A087780 More terms from _David Wasserman_, Jun 17 2005