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.

This page as a plain text file.
%I A131323 #49 Apr 22 2025 04:00:38
%S A131323 3,11,15,19,27,35,43,47,51,59,63,67,75,79,83,91,99,107,111,115,123,
%T A131323 131,139,143,147,155,163,171,175,179,187,191,195,203,207,211,219,227,
%U A131323 235,239,243,251,255,259,267,271,275,283,291,299,303,307,315,319,323,331
%N A131323 Odd numbers whose binary expansion ends in an even number of 1's.
%C A131323 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
%C A131323 Evil and odious terms alternate. - _Vladimir Shevelev_, Jun 22 2009
%C A131323 Also odd numbers of the form m = (A079523(k)-1)/2. - _Vladimir Shevelev_, Jul 06 2009
%C A131323 As a set, this is the complement of A079523 in the odd numbers. - _Michel Dekking_, Feb 13 2019
%C A131323 From _Ctibor O. Zizka_, Dec 28 2024: (Start)
%C A131323 Numbers k >= 1 such that (k + 1)*(k + 2*r)/2 is not a square for any r >= 1.
%C A131323 Numbers k such that A076114(k + 1) = 0. (End)
%H A131323 Robert Israel, <a href="/A131323/b131323.txt">Table of n, a(n) for n = 1..10000</a>
%H A131323 Thomas Zaslavsky, <a href="/A075326/a075326_2.pdf">Anti-Fibonacci Numbers: A Formula</a>, Sep 26 2016.
%F A131323 a(n) = 2*A079523(n) + 1. - _Michel Dekking_, Feb 13 2019
%e A131323 11 in binary is 1011, which ends with two 1's.
%p A131323 N:= 1000: # to get all terms up to N
%p A131323 Odds:= [seq(2*i+1,i=0..floor((N-1)/2)]:
%p A131323 f:= proc(n) local L,x;
%p A131323    L:= convert(n,base,2);
%p A131323    x:= ListTools:-Search(0,L);
%p A131323    if x = 0 then type(nops(L),even) else type(x,odd) fi
%p A131323 end proc:
%p A131323 A131323:= select(f,Odds); # _Robert Israel_, Apr 02 2014
%t A131323 Select[Range[500], OddQ[ # ] && EvenQ[FactorInteger[ # + 1][[1, 2]]] &] (* _Stefan Steinerberger_, Dec 18 2007 *)
%t A131323 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 *)
%o A131323 (PARI) is(n)=n%2 && valuation(n+1,2)%2==0 \\ _Charles R Greathouse IV_, Aug 20 2013
%o A131323 (Python)
%o A131323 from itertools import count, islice
%o A131323 def A131323_gen(startvalue=3): # generator of terms >= startvalue
%o A131323     return map(lambda n:(n<<1)+1,filter(lambda n:(~(n+1)&n).bit_length()&1,count(max(startvalue>>1,1))))
%o A131323 A131323_list = list(islice(A131323_gen(),30)) # _Chai Wah Wu_, Sep 11 2024
%o A131323 (Python)
%o A131323 def A131323(n):
%o A131323     def bisection(f,kmin=0,kmax=1):
%o A131323         while f(kmax) > kmax: kmax <<= 1
%o A131323         kmin = kmax >> 1
%o A131323         while kmax-kmin > 1:
%o A131323             kmid = kmax+kmin>>1
%o A131323             if f(kmid) <= kmid:
%o A131323                 kmax = kmid
%o A131323             else:
%o A131323                 kmin = kmid
%o A131323         return kmax
%o A131323     def f(x):
%o A131323         c, s = n+x, bin(x+1)[2:]
%o A131323         l = len(s)
%o A131323         for i in range(l&1,l,2):
%o A131323             c -= int(s[i])+int('0'+s[:i],2)
%o A131323         return c
%o A131323     return bisection(f,n,n)<<1|1 # _Chai Wah Wu_, Jan 29 2025
%Y A131323 Cf. A076114, A079523, A121539.
%K A131323 nonn,easy
%O A131323 1,1
%A A131323 _Nadia Heninger_ and _N. J. A. Sloane_, Dec 16 2007
%E A131323 More terms from _Stefan Steinerberger_, Dec 18 2007