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-6 of 6 results.

A080118 Intersection of A080117 and A014486.

Original entry on oeis.org

2, 10, 52, 738, 2866, 4023888, 921787428, 48034443442, 68055676507664, 210067141980993186, 1170565600000913519680, 257265188079961379006564, 3380147659553723806281906, 4190418227928183517574537416244
Offset: 1

Views

Author

Antti Karttunen, Feb 11 2003

Keywords

Crossrefs

a(n) = A014486(A080119(n)). Same sequence in binary: A080120.

Programs

A080110 Characteristic function of A080112.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0
Offset: 1

Views

Author

Antti Karttunen, Feb 11 2003

Keywords

Programs

A080111 Characteristic function of A080113.

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1
Offset: 1

Views

Author

Antti Karttunen, Feb 11 2003

Keywords

Programs

A080146 Binary encoding of quadratic residue set for each prime. a(n) = A055094(A000040(n)).

Original entry on oeis.org

1, 2, 9, 52, 738, 2829, 53643, 162438, 4023888, 166236537, 921787428, 48034254669, 935251837851, 2558696229078, 68055676507664, 2655011771373417, 210067141980993186, 831463105466530077, 42882922858578320598
Offset: 1

Views

Author

Antti Karttunen, Feb 11 2003

Keywords

Crossrefs

Programs

  • Maple
    with(numtheory,ithprime); A080146 := n -> A055094(ithprime(n));
  • Mathematica
    A055094[n_] := With[{rr = Table[Mod[k^2, n], {k, 1, n-1}] // Union}, Boole[MemberQ[rr, #]]& /@ Range[n-1]] // FromDigits[#, 2]&;
    a[n_] := A055094[Prime[n]];
    Table[a[n], {n, 1, 20}] (* Jean-François Alcover, Sep 20 2022 *)
  • PARI
    a(n) = my(p=prime(n)); sum(k=1, p-1, 2^(k-1)*(0Michel Marcus, Sep 20 2022; after A055094

Formula

a(A080148(n)) = A080117(A080148(n)).

A080261 Simple involution of natural numbers: complement [binary_width(n)/2] least significant bits in the binary expansion of n.

Original entry on oeis.org

0, 1, 3, 2, 5, 4, 7, 6, 11, 10, 9, 8, 15, 14, 13, 12, 19, 18, 17, 16, 23, 22, 21, 20, 27, 26, 25, 24, 31, 30, 29, 28, 39, 38, 37, 36, 35, 34, 33, 32, 47, 46, 45, 44, 43, 42, 41, 40, 55, 54, 53, 52, 51, 50, 49, 48, 63, 62, 61, 60, 59, 58, 57, 56, 71, 70, 69, 68, 67, 66, 65, 64, 79
Offset: 0

Views

Author

Antti Karttunen, Feb 11 2003

Keywords

Examples

			Binary expansion of 9 is 1001, we complement 4/2 = two rightmost bits, yielding 1010 = 10, thus a(9)=10. Binary expansion of 20 is 10100, we complement [5/2] = 2 rightmost bits, giving 10111 = 23, thus a(20)=23.
		

Crossrefs

Used to construct A080117.

Programs

  • Maple
    A080261 := proc(n) local w; w := floor(binwidth(n)/2); RETURN(((2^w)*floor(n/(2^w)))+(((2^w)-1)-ANDnos(n,(2^w)-1))); end;
    binwidth := n -> (`if`((0 = n),1,floor_log_2(n)+1));
    floor_log_2 := proc(n) local nn,i; nn := n; for i from -1 to n do if(0 = nn) then RETURN(i); fi; nn := floor(nn/2); od; end;
  • Mathematica
    A080261[n_] := With[{w = Floor[binwidth[n]/2]}, 2^w* Floor[n/2^w] + ((2^w) - 1) - BitAnd[n, 2^w - 1]];
    binwidth [n_] :=  If[0 == n, 1, floorLog2[n] + 1];
    floorLog2[n_] := Module[{nn = n, i}, For[i = -1, i <= n, i++, If[0 == nn, Return[i]]; nn = Floor[nn/2]]];
    Table[A080261[n], {n, 0, 100}] (* Jean-François Alcover, Sep 20 2022, after Maple program *)
  • PARI
    a(n) = my(b=binary(n), k); if (#b%2, k=#b\2+2, k=#b/2+1); for (i=k, #b, b[i]=1-b[i]); fromdigits(b, 2); \\ Michel Marcus, Sep 20 2022
  • Sage
    def A080261(n) :
        w = (2*n).exact_log(2) if n != 0 else 1
        w2 = 1 << w//2
        return w2*(n//w2) + w2 - 1 - (n&(w2-1))
    [A080261(n) for n in (0..72)] # Peter Luschny, Aug 08 2012
    

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-6 of 6 results.