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

A091067 Numbers whose odd part is of the form 4k+3.

Original entry on oeis.org

3, 6, 7, 11, 12, 14, 15, 19, 22, 23, 24, 27, 28, 30, 31, 35, 38, 39, 43, 44, 46, 47, 48, 51, 54, 55, 56, 59, 60, 62, 63, 67, 70, 71, 75, 76, 78, 79, 83, 86, 87, 88, 91, 92, 94, 95, 96, 99, 102, 103, 107, 108, 110, 111, 112, 115, 118, 119, 120, 123, 124, 126, 127, 131
Offset: 1

Views

Author

Ralf Stephan, Feb 22 2004

Keywords

Comments

Either of form 2*a(m) or 4k+3, k >= 0, 0 < m < n.
A000265(a(n)) is an element of A004767.
a(n) such that A038189(a(n)) = 1.
Numbers n such that Kronecker(-n, m) = Kronecker(m, n) for all m. - Michael Somos, Sep 22 2005
From Antti Karttunen, Feb 20-21 2015: (Start)
Gives all n for which A005811(n) - A005811(n-1) = -1, from which follows that a(n) = the least k such that A255070(k) = n.
Gives the positions of even terms in A003602. (End)
Indices of negative terms in A164677. - M. F. Hasler, Aug 06 2015
Indices of the 0's in A014577. - Gabriele Fici, Jun 02 2016
Also indices of -1 in A034947. - Jianing Song, Apr 24 2021
Conjecture: alternate definition of same sequence is that a(1)=3 and a(n) is the smallest number > a(n-1) so that no number that is the sum of at most 2 terms in this sequence is a power of 2. - J. Lowell, Jan 20 2024
The asymptotic density of this sequence is 1/2. - Amiram Eldar, Aug 31 2024

Crossrefs

Essentially one less than A060833.
Characteristic function: A038189.
Complement of A091072.
First differences are in A106836 (from its second term onward).
Sequence A246590 gives the even terms.
Gives the positions of records (after zero) for A255070 (equally, the position of the first n there).
Cf. A106837 (gives n such that both n and n+1 are terms of this sequence).
Cf. A098502 (gives n such that both n and n+2 are, but n+1 is not in this sequence).

Programs

  • Haskell
    import Data.List (elemIndices)
    a091067 n = a091067_list !! (n-1)
    a091067_list = map (+ 1) $ elemIndices 1 a014707_list
    -- Reinhard Zumkeller, Sep 28 2011
    (Scheme, with Antti Karttunen's IntSeq-library, two versions)
    (define A091067 (MATCHING-POS 1 1 (COMPOSE even? A003602)))
    (define A091067 (NONZERO-POS 1 0 A038189))
    ;; Antti Karttunen, Feb 20 2015
  • Mathematica
    Select[Range[150], Mod[# / 2^IntegerExponent[#, 2], 4] == 3 &] (* Amiram Eldar, Aug 31 2024 *)
  • PARI
    for(n=1,200,if(((n/2^valuation(n,2)-1)/2)%2,print1(n",")))
    
  • PARI
    {a(n) = local(m, c); if( n<1, 0, c=0; m=1; while( cMichael Somos, Sep 22 2005 */
    
  • PARI
    is_A091067(n)=bittest(n,valuation(n,2)+1) \\ M. F. Hasler, Aug 06 2015
    
  • PARI
    a(n) = my(t=1); n<<=1; forstep(i=logint(n,2),0,-1, if(bittest(n,i)==t, n++;t=!t)); n; \\ Kevin Ryde, Mar 21 2021
    

Formula

a(n) = A060833(n+1) - 1. [See N. Sato's Feb 12 2013 comment in A060833.]
Other identities. For all n >= 1 it holds that:
A014707(a(n) + 1) = 1. - Reinhard Zumkeller, Sep 28 2011
A055975(a(n)) < 0. - Reinhard Zumkeller, Apr 28 2012
From Antti Karttunen, Feb 20-21 2015: (Start)
a(n) = A246590(n)/2.
A255070(a(n)) = n, or equally, A236840(a(n)) = 2n.
a(n) = 1 + A255068(n-1). (End)

A241816 a(n) is the largest number smaller than n that can be obtained by swapping two adjacent bits in n, or n if no such number exists.

Original entry on oeis.org

0, 1, 1, 3, 2, 3, 5, 7, 4, 5, 9, 7, 10, 11, 13, 15, 8, 9, 17, 11, 18, 19, 21, 15, 20, 21, 25, 23, 26, 27, 29, 31, 16, 17, 33, 19, 34, 35, 37, 23, 36, 37, 41, 39, 42, 43, 45, 31, 40, 41, 49, 43, 50, 51, 53, 47, 52, 53, 57, 55, 58, 59, 61, 63, 32, 33, 65, 35, 66, 67, 69
Offset: 0

Views

Author

Philippe Beaudoin, Aug 19 2014

Keywords

Comments

Equivalently, a(n) is obtained by swapping the first pair of adjacent bits equal to "10", if such a pair exists. [Here the first pair means the first pair from the right, the least significant end of binary expansion. Comment clarified by Antti Karttunen, Feb 20 2015.]
The fixed point of a(n) is equal to 2^k - 1, where k = A000120(n). In other words, applying a(n) repeatedly packs all the bits to the right.
a(n) is related to the "bubble sort" algorithm. If an array of elements from two classes is encoded in a binary number, a(n) is the first intermediate result that will be obtained when starting a bubble sort from n.

Examples

			If n = 5 = 101_2 then a(n) = 011_2 = 3.
If n = 8 = 1000_2 then a(8) = 0100_2 = 4.
		

Crossrefs

Programs

  • Haskell
    a241816 n = f (a030308_row n) [] where
       f [] _ = n
       f (0 : 1 : us) vs = foldr (\b y -> 2 * y + b) 0 $
                                 reverse vs ++ 1 : 0 : us
       f (u : us) vs     = f us (u : vs)
    -- Reinhard Zumkeller, Sep 03 2014
    
  • Mathematica
    A241816[n_] := FromDigits[StringReverse[StringReplace[StringReverse[IntegerString[n, 2]], "01" -> "10", 1]], 2];
    Array[A241816, 100, 0] (* Paolo Xausa, Mar 07 2025 *)
  • Python
    def bitswap(n):
      # Find first bit = 0.
      m = n
      i = 0
      while (m > 0):
        if m % 2 == 0:
          break
        m = m >> 1
        i = i + 1
      if m == 0:
         return n
      # Find first bit = 1 following that 0.
      while (m > 0):
        if m % 2 == 1:
          break
        m = m >> 1
        i = i + 1
      # Swap
      return n & ~(1 << i) | (1 << (i-1))
    
  • Python
    def A241816(n):
        s = bin(n)[2:]
        for i in range(len(s)-2, -1, -1):
            if s[i:i+2] == '10':
                return int(s[:i]+'01'+s[i+2:], 2)
        else:
            return n
    # Chai Wah Wu, Sep 05 2014
    
  • Scheme
    ;; With memoization-macro definec.
    (definec (A241816 n) (cond ((zero? n) n) ((odd? n) (+ 1 (* 2 (A241816 (/ (- n 1) 2))))) ((zero? (modulo n 4)) (* 2 (A241816 (/ n 2)))) (else (- n 1))))
    ;; Antti Karttunen, Feb 21 2015

Formula

a(0) = 0; a(2n+1) = 1+2*a(n), a(4n) = 2*a(2n), a(4n+2) = 4n+1. - Antti Karttunen, Feb 21 2015

Extensions

Definition clarified by Chai Wah Wu, Sep 05 2014

A246579 G.f.: x^(k^2)/(mul(1-x^(2*i),i=1..k)*mul(1+x^(2*r-1),r=1..oo)) with k=3.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 2, -3, 5, -7, 11, -15, 21, -29, 39, -52, 69, -90, 116, -150, 190, -241, 303, -379, 470, -583, 716, -878, 1071, -1302, 1575, -1902, 2285, -2739, 3273, -3899, 4631, -5489, 6486, -7647, 8996, -10557, 12363, -14450, 16853, -19618, 22798, -26441
Offset: 0

Views

Author

N. J. A. Sloane, Aug 31 2014

Keywords

References

  • Fulman, Jason. Random matrix theory over finite fields. Bull. Amer. Math. Soc. (N.S.) 39 (2002), no. 1, 51--85. MR1864086 (2002i:60012). See top of page 70, Eq. 2, with k=3.

Crossrefs

k=0,1,2 give (apart perhaps from signs) A081360, A038348, A096778. Cf. A246590.

Programs

  • Maple
    fU:=proc(k) local a,i,r;
    a:=x^(k^2)/mul(1-x^(2*i),i=1..k);
    a:=a/mul(1+x^(2*r-1),r=1..101);
    series(a,x,101);
    seriestolist(%);
    end;
    fU(3);
Showing 1-3 of 3 results.