login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A087780
Number of non-congruent solutions to x^2 == 2 mod n.
3
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, 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, 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
OFFSET
1,7
LINKS
FORMULA
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
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
MATHEMATICA
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 *)
PROG
(Sage)
def A087780(n) :
res = 1
for (p, m) in factor(n) :
if p % 8 in [1, 7] : res *= 2
elif not (p==2 and m==1) : return 0
return res
# Eric M. Schmidt, Apr 20 2013
(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
CROSSREFS
KEYWORD
mult,nonn,easy
AUTHOR
Yuval Dekel (dekelyuval(AT)hotmail.com), Oct 06 2003
EXTENSIONS
More terms from David Wasserman, Jun 17 2005
STATUS
approved