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.

Previous Showing 41-50 of 61 results. Next

A178733 a(n) = n XOR 7n, where XOR is bitwise XOR.

Original entry on oeis.org

0, 6, 12, 22, 24, 38, 44, 54, 48, 54, 76, 70, 88, 86, 108, 102, 96, 102, 108, 150, 152, 134, 140, 182, 176, 182, 172, 166, 216, 214, 204, 198, 192, 198, 204, 214, 216, 294, 300, 310, 304, 310, 268, 262, 280, 278, 364, 358, 352, 358, 364, 342, 344, 326, 332, 438
Offset: 0

Views

Author

Dmitry Kamenetsky, Jun 08 2010

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := BitXor[n, 7 n]; Array[f, 60, 0] (* Robert G. Wilson v, Jun 09 2010 *)

Extensions

a(30) onwards from Robert G. Wilson v, Jun 09 2010

A178735 a(n) = n XOR 9n, where XOR is bitwise XOR.

Original entry on oeis.org

0, 8, 16, 24, 32, 40, 48, 56, 64, 88, 80, 104, 96, 120, 112, 136, 128, 136, 176, 184, 160, 168, 208, 216, 192, 248, 240, 232, 224, 280, 272, 264, 256, 264, 272, 280, 352, 360, 368, 376, 320, 344, 336, 424, 416, 440, 432, 392, 384, 392, 496, 504, 480, 488, 464
Offset: 0

Views

Author

Dmitry Kamenetsky, Jun 08 2010

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := BitXor[n, 9 n]; Array[f, 60, 0] (* Robert G. Wilson v, Jun 09 2010 *)

Extensions

a(30) onwards from Robert G. Wilson v, Jun 09 2010

A178736 a(n) = n XOR 10n, where XOR is bitwise XOR.

Original entry on oeis.org

0, 11, 22, 29, 44, 55, 58, 65, 88, 83, 110, 101, 116, 143, 130, 153, 176, 187, 166, 173, 220, 199, 202, 241, 232, 227, 286, 277, 260, 319, 306, 297, 352, 363, 374, 381, 332, 343, 346, 417, 440, 435, 398, 389, 404, 495, 482, 505, 464, 475, 454, 461, 572, 551
Offset: 0

Views

Author

Dmitry Kamenetsky, Jun 08 2010

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := BitXor[n, 10 n]; Array[f, 60, 0] (* Robert G. Wilson v, Jun 09 2010 *)

Extensions

a(30) onwards from Robert G. Wilson v, Jun 09 2010

A270437 Multiplicative with a(p^e) = p^(e XOR 2e), where XOR is bitwise-xor.

Original entry on oeis.org

1, 8, 27, 64, 125, 216, 343, 32, 729, 1000, 1331, 1728, 2197, 2744, 3375, 4096, 4913, 5832, 6859, 8000, 9261, 10648, 12167, 864, 15625, 17576, 243, 21952, 24389, 27000, 29791, 32768, 35937, 39304, 42875, 46656, 50653, 54872, 59319, 4000, 68921, 74088, 79507, 85184, 91125, 97336, 103823, 110592, 117649, 125000
Offset: 1

Views

Author

Antti Karttunen, May 27 2016

Keywords

Comments

Multiplicative with a(p^e) = p^A048724(e), where A048724(e) = (e XOR 2e).
Multiples of 8 in the ring defined in A329329. - Peter Munn, Jan 17 2020

Crossrefs

Cf. A262675 (same sequence sorted into ascending order).
Cf. also A270418, A270419, A270436 and permutation A273671.
Row 8 and column 8 of A329329.

Programs

  • Mathematica
    f[p_, e_] := p^BitXor[2*e, e]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 50] (* Amiram Eldar, Sep 07 2023 *)

Formula

a(1) = 1, for n > 1, a(n) = A020639(n)^A048724(A067029(n)) * a(A028234(n)).
Other identities. For all n >= 1:
A270418(a(n)) = 1, A270419(a(n)) = n.
a(n) = A329329(n,8) = A329329(8,n). - Peter Munn, Jan 17 2020

Extensions

Name changed by Antti Karttunen, Sep 07 2023

A292372 A binary encoding of 2-digits in base-4 representation of n.

Original entry on oeis.org

0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 4, 4, 5, 4, 4, 4, 5, 4, 6, 6, 7, 6, 4, 4, 5, 4, 0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 2, 3, 2, 0, 0, 1, 0, 4, 4, 5, 4, 4, 4, 5, 4, 6, 6, 7, 6, 4, 4, 5, 4, 0, 0, 1, 0, 0, 0, 1, 0, 2
Offset: 0

Views

Author

Antti Karttunen, Sep 15 2017

Keywords

Examples

			   n      a(n)     base-4(n)  binary(a(n))
                  A007090(n)  A007088(a(n))
  --      ----    ----------  ------------
   1        0          1           0
   2        1          2           1
   3        0          3           0
   4        0         10           0
   5        0         11           0
   6        1         12           1
   7        0         13           0
   8        2         20          10
   9        2         21          10
  10        3         22          11
  11        2         23          10
  12        0         30           0
  13        0         31           0
  14        1         32           1
  15        0         33           0
  16        0        100           0
  17        0        101           0
  18        1        102           1
		

Crossrefs

Cf. A289814 (analogous sequence for base-3).

Programs

  • Mathematica
    Table[FromDigits[IntegerDigits[n, 4] /. k_ /; IntegerQ@ k :> If[k == 2, 1, 0], 2], {n, 0, 120}] (* Michael De Vlieger, Sep 21 2017 *)
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n):
        k=digits(n, 4)[1:]
        return 0 if n==0 else int("".join('1' if i==2 else '0' for i in k), 2)
    print([a(n) for n in range(121)]) # Indranil Ghosh, Sep 21 2017
    
  • Python
    def A292372(n): return 0 if (m:=n&~(n<<1)) < 2 else int(bin(m)[-2:1:-2][::-1],2) # Chai Wah Wu, Jun 30 2022

Formula

a(n) = A059906(n AND A048724(n)), where AND is a bitwise-AND (A004198).
For all n >= 0, A000120(a(n)) = A160382(n).

A277825 a(n) = A048725(A065621(n)) = A048720(A065621(n),5).

Original entry on oeis.org

5, 10, 27, 20, 57, 54, 39, 40, 125, 114, 99, 108, 65, 78, 95, 80, 245, 250, 235, 228, 201, 198, 215, 216, 141, 130, 147, 156, 177, 190, 175, 160, 485, 490, 507, 500, 473, 470, 455, 456, 413, 402, 387, 396, 417, 430, 447, 432, 277, 282, 267, 260, 297, 294, 311, 312, 365, 354, 371, 380, 337, 350, 335, 320, 965, 970, 987, 980, 1017, 1014, 999, 1000
Offset: 1

Views

Author

Antti Karttunen, Nov 02 2016

Keywords

Crossrefs

Column 3 of A277820, Column 5 of A277320.

Programs

Formula

a(n) = A048724(A277823(n)) = A048725(A065621(n)).
a(n) = A048720(A065621(n),5).

A295881 Reversing binary representation of the deficiency of n, A033879(n).

Original entry on oeis.org

1, 1, 2, 1, 4, 0, 14, 1, 13, 2, 26, 12, 28, 4, 14, 1, 16, 5, 50, 6, 26, 8, 62, 20, 55, 26, 22, 0, 44, 20, 38, 1, 50, 22, 62, 53, 100, 16, 62, 30, 104, 20, 122, 4, 28, 52, 118, 36, 121, 11, 38, 14, 84, 20, 110, 24, 98, 42, 74, 80, 76, 44, 62, 1, 118, 20, 194, 26, 122, 12, 206, 85, 200, 98, 42, 28, 74, 20, 214, 46, 121
Offset: 1

Views

Author

Antti Karttunen, Dec 04 2017

Keywords

Comments

For all n, A010060(a(A005100(n))) = 1 and A010060(a(A023196(n))) = 0. That is, for the deficient numbers a(n) is an odious number (A000069) and for the nondeficient numbers a(n) is an evil number (A001969).

Crossrefs

Cf. A000396 (gives the positions of zeros).

Programs

Formula

If A033879(n) <= 0, a(n) = A048724(-A033879(n)), otherwise a(n) = A065621(A033879(n)).
For all n >= 1, A065620(a(n)) = A033879(n).

A104895 a(0)=0; thereafter a(2n) = -2*a(n), a(2n+1) = 2*a(n) - 1.

Original entry on oeis.org

0, -1, -2, 1, -4, 3, 2, -3, -8, 7, 6, -7, 4, -5, -6, 5, -16, 15, 14, -15, 12, -13, -14, 13, 8, -9, -10, 9, -12, 11, 10, -11, -32, 31, 30, -31, 28, -29, -30, 29, 24, -25, -26, 25, -28, 27, 26, -27, 16, -17, -18, 17, -20, 19, 18, -19, -24, 23, 22, -23, 20, -21, -22, 21, -64, 63, 62, -63, 60, -61, -62, 61, 56, -57, -58, 57, -60, 59
Offset: 0

Views

Author

Philippe Deléham, Apr 24 2005

Keywords

Comments

Columns of table in A104894 written in base 10.
Conjecture: the positions where 0, 1, 2, 3, ... appear are given by A048724; the positions where -1, -2, -3, ... appear are given by A065621.

Crossrefs

The negative of entry A065620.

Programs

  • Haskell
    import Data.List (transpose)
    a104895 n = a104895_list !! n
    a104895_list = 0 : concat (transpose [map (negate . (+ 1)) zs, tail zs])
                   where zs = map (* 2) a104895_list
    -- Reinhard Zumkeller, Mar 26 2014
    
  • Maple
    f:=proc(n) option remember; if n=0 then RETURN(0); fi; if n mod 2 = 0 then RETURN(2*f(n/2)); else RETURN(-2*f((n-1)/2)-1); fi; end;
  • Mathematica
    a[0] = 0;
    a[n_]:= a[n]= If[EvenQ[n], 2 a[n/2], -2 a[(n-1)/2] - 1];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Aug 03 2018 *)
  • Sage
    def a(n):
        if (n==0): return 0
        elif (mod(n,2)==0): return 2*a(n/2)
        else: return -2*a((n-1)/2) - 1
    [a(n) for n in (0..100)] # G. C. Greubel, Jun 15 2021

Formula

a(0) = 0 and for k>=0, 0<= j <2^k, a(2^k + j) = a(j) + 2^k if a(j)<0, a(2^k + j) = a(j) - 2^k if a(j)>=0.
Sum_{0 <= n <= 2^k - 1} a(n) = - 2^(k-1).
Sum_{0 <= n <= 2^k - 1} |a(n)| = 4^(k-1).
a(n) = -A065620(n). - M. F. Hasler, Apr 16 2018

Extensions

Corrected by N. J. A. Sloane, Nov 05 2005
Edited by N. J. A. Sloane, Apr 25 2018

A213064 Bitwise AND of 2n with the one's-complement of n.

Original entry on oeis.org

0, 2, 4, 4, 8, 10, 8, 8, 16, 18, 20, 20, 16, 18, 16, 16, 32, 34, 36, 36, 40, 42, 40, 40, 32, 34, 36, 36, 32, 34, 32, 32, 64, 66, 68, 68, 72, 74, 72, 72, 80, 82, 84, 84, 80, 82, 80, 80, 64, 66, 68, 68, 72, 74, 72, 72, 64, 66, 68, 68, 64, 66, 64, 64, 128, 130, 132
Offset: 0

Views

Author

Juli Mallett, Jun 04 2012

Keywords

Comments

In two's-complement binary arithmetic, -n is ~(n - 1). As such, this could be written instead as a(n) = 2n AND -(n + 1). Further, because the least significant bits are never matched both of the operands to the AND, the negative form of n can be used rather than the one's-complement, i.e. a(n) = 2n AND -n.
a(n) has a 1-bit immediately above each run of 1's in n, and everywhere else 0's. Or equivalently, each 01 bit pair in n becomes 10 in a(n) and everywhere else 0's. The most significant 1-bit of n has a 0 above it for this purpose, so is an 01 bit pair. - Kevin Ryde, Jun 04 2020

Examples

			For n = 31, 2n is 62, which in binary is 111110, as multiplication by two is the same as shifting the bits of 31 (11111) to the left by one. As the number is one less than a power of two, all of its least significant bits are set. Before the shift, the most significant bit has a value of 16. After the shift, the most significant bit has a value of 32.
The ~n has all bits set but the five least significant, the highest bit set being the power of two above n: .....111111111100000. When these two values are ANDed together, only the 6th bit, that with the value of 32, is common to them, and the result is 32.
From _Kevin Ryde_, Jun 04 2020: (Start)
     n = 1831 = binary  11100100111
  a(n) = 2120 = binary 100001001000   1-bit above each run
(End)
		

Crossrefs

Cf. A048724 (with XOR).

Programs

  • C
    int a(int n) { return ((n + n) & ~n); }
    
  • Mathematica
    Table[BitAnd[2n, -n], {n, 0, 66}] (* Alonso del Arte, Jun 04 2012 *)
  • PARI
    a(n) = bitnegimply(n<<1,n); \\ Kevin Ryde, Jun 04 2020
    
  • Python
    def A213064(n): return n<<1&~n # Chai Wah Wu, Jun 29 2022
  • R
    # with bitops
    bitAnd(2 * n, bitFlip(n))
    

Formula

a(n) = 2n AND ~n
a(n) = 2*A292272(n). - Kevin Ryde, Jun 04 2020

A268386 a(n) = A193231(A268387(n)).

Original entry on oeis.org

0, 1, 1, 3, 1, 0, 1, 2, 3, 0, 1, 2, 1, 0, 0, 5, 1, 2, 1, 2, 0, 0, 1, 3, 3, 0, 2, 2, 1, 1, 1, 4, 0, 0, 0, 0, 1, 0, 0, 3, 1, 1, 1, 2, 2, 0, 1, 4, 3, 2, 0, 2, 1, 3, 0, 3, 0, 0, 1, 3, 1, 0, 2, 6, 0, 1, 1, 2, 0, 1, 1, 1, 1, 0, 2, 2, 0, 1, 1, 4, 5, 0, 1, 3, 0, 0, 0, 3, 1, 3, 0, 2, 0, 0, 0, 5, 1, 2, 2, 0, 1, 1, 1, 3, 1, 0, 1, 1, 1, 1, 0, 4, 1, 1, 0, 2, 2, 0, 0, 2
Offset: 1

Views

Author

Antti Karttunen, Feb 10 2016

Keywords

Crossrefs

A003987, A048720, A059897, A193231, A268385, A268387 are used in definitions of this sequence.
Cf. A000028 (indices of odd numbers), A000379 (indices of even numbers), A268390 (indices of zeros).

Programs

  • Mathematica
    f[n_] := Which[0 <= # <= 1, #, EvenQ@ #, BitXor[2 #, #] &[f[#/2]], True, BitXor[#, 2 # + 1] &[f[(# - 1)/2]]] &@ Abs@ n; {0}~Join~Table[f[BitXor @@ Map[Last, FactorInteger@ n]], {n, 2, 120}] (* Michael De Vlieger, Feb 12 2016, after Robert G. Wilson v at A048724 and A065621 *)
  • PARI
    a268387(n) = {my(f = factor(n), b = 0); for (k=1, #f~, b = bitxor(b, f[k, 2]); ); b; }
    a193231(n) = {my(x='x); subst(lift(Mod(1, 2)*subst(Pol(binary(n), x), x, 1+x)), x, 2)};
    a(n) = a193231(a268387(n)); \\ Michel Marcus, May 09 2020
  • Scheme
    (define (A268386 n) (A193231 (A268387 n)))
    

Formula

The following two formulas are equivalent because A193231 distributes over bitwise XOR (A003987):
a(n) = A193231(A268387(n)) and
a(n) = A268387(A268385(n)).
a(2^k) = A193231(k). - Peter Munn, May 07 2020
From Peter Munn, Jun 02 2020: (Start)
Alternative definition, for n, k >= 1, where XOR denotes A003987:
a(prime(n)) = 1, where prime(n) = A000040(n);
a(n^2) = a(n) XOR (2 * a(n)) = A048720(a(n), 3);
a(A059897(n, k)) = a(n) XOR a(k).
(End)
Previous Showing 41-50 of 61 results. Next