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.

Original entry on oeis.org

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

Views

Author

Yuval Dekel (dekelyuval(AT)hotmail.com), Oct 06 2003

Keywords

Crossrefs

Programs

  • 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 *)
  • 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
  • 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
    

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

Extensions

More terms from David Wasserman, Jun 17 2005