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.

Showing 1-2 of 2 results.

A080117 Binary encoding of quadratic residue set formed for n-th prime, coerced to "complementarily symmetric binary sequence" with A080261 if the prime is of the form 4k+1.

Original entry on oeis.org

2, 10, 52, 738, 2866, 53620, 162438, 4023888, 166243974, 921787428, 48034443442, 935251508324, 2558696229078, 68055676507664, 2655011787909270, 210067141980993186, 831463106366605026, 42882922858578320598
Offset: 2

Views

Author

Antti Karttunen, Feb 11 2003

Keywords

Crossrefs

Programs

  • Maple
    with(numtheory,ithprime); A080117 := proc(n) local c,p; p := ithprime(n); c := A055094(p); if(3 = (p mod 4)) then RETURN(c); else RETURN(A080261(c)); fi; end;
  • Mathematica
    A055094[n_] := With[{rr = Table[Mod[k^2, n], {k, 1, n-1}] // Union}, Boole[ MemberQ[rr, #]] & /@ Range[n-1]] // FromDigits[#, 2]&;
    A080261[n_] := Module[{bb = IntegerDigits[n, 2]}, lg = Length[bb]; Do[ bb[[i]] = 1 - bb[[i]], {i, lg, lg - Floor[lg/2] + 1, -1}]; FromDigits[ bb, 2]];
    a[n_] := Module[{c, p = Prime[n]}, c = A055094[p]; If[Mod[p, 4] == 3, c, A080261[c]]]; Table[a[n], {n, 2, 20}] (* Jean-François Alcover, Mar 05 2016, adapted from Maple *)
  • Sage
    # uses[A080261]
    def A080117(n) :
        p = nth_prime(n)
        c = A055094(p)
        return c if 3 == p%4 else A080261(c)
    [A080117(n) for n in (2..19)] # Peter Luschny, Aug 09 2012

Formula

a(A080148(n)) = A080146(A080148(n))

A280109 a(n) is the decimal value corresponding to the binary representation of the distribution of quadratic residues (value=1) and non-quadratic residues (value=0) mod n, where numbers are ordered left to right from 0 to n-1.

Original entry on oeis.org

1, 3, 6, 12, 25, 54, 116, 200, 402, 825, 1762, 3204, 6925, 14964, 25904, 51264, 119179, 206226, 424582, 836616, 1648692, 3610338, 8218192, 13125760, 26518825, 56736525, 105587858, 210503748, 434671993, 848848176, 1995529252, 3359686720, 7257392290, 15621149067
Offset: 1

Views

Author

Adnan Baysal, Dec 26 2016

Keywords

Comments

Sort mod n numbers {0,1,...,n-1} in ascending order. For each modular number i, write 1 if i is a quadratic residue mod n (i.e., it has a square root), else write 0. The corresponding n-bit number is a(n).

Examples

			For n = 10, quadratic residues are 0, 1, 4, 5, 6, 9 so a(10) is 1100111001 in binary which is 825.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Total[ 2^(n -1 -Union[ Mod[ Range[0, n - 1]^2, n]] )]; Array[f, 34] (* Robert G. Wilson v, Dec 28 2016 *)
  • Python
    def qr_distribution(N):
        QR = []
        QN = []
        for i in range(N):
            t = (i*i)%N
            if t not in QR: QR.append(t)
        for i in range(N):
            if i not in QR: QN.append(i)
        out = 0
        for i in range(0,N):
            out *= 2
            if i in QR: out += 1
        return out
Showing 1-2 of 2 results.