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 11-13 of 13 results.

A229763 a(n) = (2*n) XOR n AND n, where AND and XOR are bitwise logical operators.

Original entry on oeis.org

0, 1, 2, 1, 4, 5, 2, 1, 8, 9, 10, 9, 4, 5, 2, 1, 16, 17, 18, 17, 20, 21, 18, 17, 8, 9, 10, 9, 4, 5, 2, 1, 32, 33, 34, 33, 36, 37, 34, 33, 40, 41, 42, 41, 36, 37, 34, 33, 16, 17, 18, 17, 20, 21, 18, 17, 8, 9, 10, 9, 4, 5, 2, 1, 64, 65, 66, 65, 68, 69, 66, 65, 72, 73, 74
Offset: 0

Views

Author

Alex Ratushnyak, Sep 28 2013

Keywords

Comments

a(n) is the least significant 1-bit of each run of consecutive 1's in n, and everywhere else 0's. Or equivalently, clear to 0 each 1-bit which has another 1 immediately below. - Kevin Ryde, Feb 27 2021

Examples

			From _Kevin Ryde_, Feb 27 2021: (Start)
     n = 1831 = binary 11100100111
  a(n) =  289 = binary   100100001   low 1-bit each run
(End)
		

Crossrefs

Cf. A003188 (n XOR floor(n/2)).
Cf. A048724 (n XOR (n*2)).
Cf. A048735 (n AND floor(n/2)).
Cf. A213370 (n AND (n*2)).
Cf. A213064 (n XOR (n*2) AND (n*2)).
Cf. A229762 (n XOR floor(n/2) AND floor(n/2), 1-bit below each run).
Cf. A292272 (high 1-bit each run).

Programs

  • Haskell
    import Data.Bits ((.&.), xor, shiftL)
    a229763 n = (shiftL n 1 `xor` n) .&. n :: Int
    -- Reinhard Zumkeller, Oct 10 2013
    
  • Mathematica
    Array[BitAnd[BitXor[2 #, #], #] &, 75, 0] (* Michael De Vlieger, Nov 03 2022 *)
  • PARI
    a(n) = bitnegimply(n,n<<1); \\ Kevin Ryde, Feb 27 2021
  • Python
    for n in range(333): print (2*n ^ n) & n,
    
  • Python
    def A229763(n): return n&~(n<<1) # Chai Wah Wu, Jun 29 2022
    

Formula

a(n) = ((2*n) XOR n) AND n = ((2*n) AND n) XOR n.
a(2n) = 2a(n), a(2n+1) = A229762(n). - Ralf Stephan, Oct 07 2013
a(n) = n AND NOT 2n. - Chai Wah Wu, Jun 29 2022
G.f.: x/(1 - x^2) + Sum_{k>=1}(2^k*x^(2^k)/((1 - x)*(1 + x^(2^k))*(1 + x^(2^(k - 1))))). - Miles Wilson, Jan 24 2025

A350775 The balanced ternary expansion of a(n) is obtained by multiplying adjacent digits in the balanced ternary expansion of n: a(Sum_{k >= 0} t_k * 3^k) = Sum_{k >= 0} t_k * t_{k+1} * 3^k (with -1 <= t_k <= 1 for any k >= 0).

Original entry on oeis.org

0, 0, -1, 0, 1, -2, -3, -4, 0, 0, 0, 2, 3, 4, -5, -6, -7, -9, -9, -9, -13, -12, -11, 1, 0, -1, 0, 0, 0, -1, 0, 1, 7, 6, 5, 9, 9, 9, 11, 12, 13, -14, -15, -16, -18, -18, -18, -22, -21, -20, -26, -27, -28, -27, -27, -27, -28, -27, -26, -38, -39, -40, -36, -36
Offset: 0

Views

Author

Rémy Sigrist, Jan 15 2022

Keywords

Comments

This sequence is to balanced ternary what A048735 is to binary, or what A330633 is to decimal.

Examples

			The first terms, in decimal and in balanced ternary, are:
  n   a(n)  bter(n)  bter(a(n))
  --  ----  -------  ----------
   0     0        0           0
   1     0        1           0
   2    -1       1T           T
   3     0       10           0
   4     1       11           1
   5    -2      1TT          T1
   6    -3      1T0          T0
   7    -4      1T1          TT
   8     0      10T           0
   9     0      100           0
  10     0      101           0
  11     2      11T          1T
  12     3      110          10
  13     4      111          11
		

Crossrefs

Programs

  • PARI
    a(n) = { my (v=0, p=0, d); for (x=-1, oo, if (n==0, return (v), d=[0, 1, -1][1+n%3]; v+=p*d*3^x; n=(n-d)/3; p=d)) }

Formula

a(n) = 0 iff n belongs to A350776.

A269170 a(n) = n OR floor(n/2), where OR is bitwise-OR (A003986).

Original entry on oeis.org

0, 1, 3, 3, 6, 7, 7, 7, 12, 13, 15, 15, 14, 15, 15, 15, 24, 25, 27, 27, 30, 31, 31, 31, 28, 29, 31, 31, 30, 31, 31, 31, 48, 49, 51, 51, 54, 55, 55, 55, 60, 61, 63, 63, 62, 63, 63, 63, 56, 57, 59, 59, 62, 63, 63, 63, 60, 61, 63, 63, 62, 63, 63, 63, 96, 97, 99, 99, 102, 103, 103, 103, 108, 109, 111, 111, 110, 111
Offset: 0

Views

Author

Antti Karttunen, Feb 22 2016

Keywords

Comments

Fibbinary numbers (A003714) give all integers n >= 0 for which a(n) = A003188(n) and also for which a(n) = A032766(n).

Crossrefs

Cf. A163617 (even bisection).
Cf. also A003188, A048735, A032766.

Programs

Formula

a(n) = A003986(n,(n-A000035(n))/2).
Other identities and observations. For all n >= 0:
a(2n) = A163617(n).
A003188(n) <= a(n) <= A032766(n).
Previous Showing 11-13 of 13 results.