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.

A131323 Odd numbers whose binary expansion ends in an even number of 1's.

Original entry on oeis.org

3, 11, 15, 19, 27, 35, 43, 47, 51, 59, 63, 67, 75, 79, 83, 91, 99, 107, 111, 115, 123, 131, 139, 143, 147, 155, 163, 171, 175, 179, 187, 191, 195, 203, 207, 211, 219, 227, 235, 239, 243, 251, 255, 259, 267, 271, 275, 283, 291, 299, 303, 307, 315, 319, 323, 331
Offset: 1

Views

Author

Nadia Heninger and N. J. A. Sloane, Dec 16 2007

Keywords

Comments

Also numbers of the form (4^a)*b - 1 with positive integer a and odd integer b. The sequence has linear growth and the limit of a(n)/n is 6. - Stefan Steinerberger, Dec 18 2007
Evil and odious terms alternate. - Vladimir Shevelev, Jun 22 2009
Also odd numbers of the form m = (A079523(k)-1)/2. - Vladimir Shevelev, Jul 06 2009
As a set, this is the complement of A079523 in the odd numbers. - Michel Dekking, Feb 13 2019
From Ctibor O. Zizka, Dec 28 2024: (Start)
Numbers k >= 1 such that (k + 1)*(k + 2*r)/2 is not a square for any r >= 1.
Numbers k such that A076114(k + 1) = 0. (End)

Examples

			11 in binary is 1011, which ends with two 1's.
		

Crossrefs

Programs

  • Maple
    N:= 1000: # to get all terms up to N
    Odds:= [seq(2*i+1,i=0..floor((N-1)/2)]:
    f:= proc(n) local L,x;
       L:= convert(n,base,2);
       x:= ListTools:-Search(0,L);
       if x = 0 then type(nops(L),even) else type(x,odd) fi
    end proc:
    A131323:= select(f,Odds); # Robert Israel, Apr 02 2014
  • Mathematica
    Select[Range[500], OddQ[ # ] && EvenQ[FactorInteger[ # + 1][[1, 2]]] &] (* Stefan Steinerberger, Dec 18 2007 *)
    en1Q[n_]:=Module[{ll=Last[Split[IntegerDigits[n,2]]]},Union[ll] =={1} &&EvenQ[Length[ll]]]; Select[Range[1,501,2],en1Q] (* Harvey P. Dale, May 18 2011 *)
  • PARI
    is(n)=n%2 && valuation(n+1,2)%2==0 \\ Charles R Greathouse IV, Aug 20 2013
    
  • Python
    from itertools import count, islice
    def A131323_gen(startvalue=3): # generator of terms >= startvalue
        return map(lambda n:(n<<1)+1,filter(lambda n:(~(n+1)&n).bit_length()&1,count(max(startvalue>>1,1))))
    A131323_list = list(islice(A131323_gen(),30)) # Chai Wah Wu, Sep 11 2024
    
  • Python
    def A131323(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c, s = n+x, bin(x+1)[2:]
            l = len(s)
            for i in range(l&1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        return bisection(f,n,n)<<1|1 # Chai Wah Wu, Jan 29 2025

Formula

a(n) = 2*A079523(n) + 1. - Michel Dekking, Feb 13 2019

Extensions

More terms from Stefan Steinerberger, Dec 18 2007