[go: up one dir, main page]

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

%I #36 Sep 11 2024 22:48:40

%S 3,11,15,19,27,35,43,47,51,59,63,67,75,79,83,91,99,107,111,115,123,

%T 131,139,143,147,155,163,171,175,179,187,191,195,203,207,211,219,227,

%U 235,239,243,251,255,259,267,271,275,283,291,299,303,307,315,319,323,331

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

%C 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 Evil and odious terms alternate. - _Vladimir Shevelev_, Jun 22 2009

%C Also odd numbers of the form m = (A079523(k)-1)/2. - _Vladimir Shevelev_, Jul 06 2009

%C As a set, this is the complement of A079523 in the odd numbers. - _Michel Dekking_, Feb 13 2019

%H Robert Israel, <a href="/A131323/b131323.txt">Table of n, a(n) for n = 1..10000</a>

%H Thomas Zaslavsky, <a href="/A075326/a075326_2.pdf">Anti-Fibonacci Numbers: A Formula</a>, Sep 26 2016

%F a(n) = 2*A079523(n) + 1. - _Michel Dekking_, Feb 13 2019

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

%p N:= 1000: # to get all terms up to N

%p Odds:= [seq(2*i+1,i=0..floor((N-1)/2)]:

%p f:= proc(n) local L,x;

%p L:= convert(n,base,2);

%p x:= ListTools:-Search(0,L);

%p if x = 0 then type(nops(L),even) else type(x,odd) fi

%p end proc:

%p A131323:= select(f,Odds); # _Robert Israel_, Apr 02 2014

%t Select[Range[500], OddQ[ # ] && EvenQ[FactorInteger[ # + 1][[1, 2]]] &] (* _Stefan Steinerberger_, Dec 18 2007 *)

%t 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 (PARI) is(n)=n%2 && valuation(n+1,2)%2==0 \\ _Charles R Greathouse IV_, Aug 20 2013

%o (Python)

%o from itertools import count, islice

%o def A131323_gen(startvalue=3): # generator of terms >= startvalue

%o return map(lambda n:(n<<1)+1,filter(lambda n:(~(n+1)&n).bit_length()&1,count(max(startvalue>>1,1))))

%o A131323_list = list(islice(A131323_gen(),30)) # _Chai Wah Wu_, Sep 11 2024

%Y Cf. A079523, A121539.

%K nonn,easy

%O 1,1

%A _Nadia Heninger_ and _N. J. A. Sloane_, Dec 16 2007

%E More terms from _Stefan Steinerberger_, Dec 18 2007