A225822 Lesser of adjacent odd numbers with different parity of binary weight and both isolated from odd numbers of same parity of binary weight.
7, 23, 31, 39, 55, 71, 87, 95, 103, 119, 127, 135, 151, 159, 167, 183, 199, 215, 223, 231, 247, 263, 279, 287, 295, 311, 327, 343, 351, 359, 375, 383, 391, 407, 415, 423, 439, 455, 471, 479, 487, 503, 511, 519, 535, 543, 551, 567, 583, 599, 607, 615, 631
Offset: 1
Links
- Brad Clardy, Table of n, a(n) for n = 1..1000
Crossrefs
Cf. A047522 (numbers congruent to {1,7} mod 8).
Cf. A199398 (XOR of first n odd numbers).
Cf. A044449 (a subset of this sequence).
Cf. A131323 (odd numbers n such that the binary expansion ends in an even number of 1's).
Cf. A047451 (numbers congruent to {0,6} mod 8).
Cf. A000120 (binary weight of n).
Cf. A079523.
Programs
-
Magma
//Function Bweight calculates the binary weight of an integer Bweight := function(m) Bweight:=0; adigs := Intseq(m,2); for n:= 1 to Ilog2(m)+1 do Bweight:=Bweight+adigs[n]; end for; return Bweight; end function; prevodi:=0; currodi:=0; m:=0; count:=0; for n:= 1 to 20000 by 2 do m:=m+1; if (Bweight(n) mod 2 eq 1) then odious:=true; else odious:=false; end if; if (odious) then currodi:=n; end if; if (currodi - prevodi eq 4) then if (m mod 2 eq 1) then count:=count+1; count,n-2; else count:=count+1;count,n-4; end if; end if; if(odious) then prevodi:=currodi; end if; end for;
-
Mathematica
2*Select[Range[1, 320, 2], EvenQ[IntegerExponent[# + 1, 2]] &] + 1 (* Amiram Eldar, Jul 24 2023 *)
-
PARI
is(n)=n%4==3 && valuation(n\4+1, 2)%2 \\ Charles R Greathouse IV, Aug 20 2013
-
Python
from itertools import count, islice def A225822_gen(startvalue=1): # generator of terms >= startvalue return map(lambda m:(m<<1)+1,filter(lambda n:n&1 and not (~(n+1)&n).bit_length()&1,count(max(startvalue,1)))) A225822__list = list(islice(A225822_gen(),30)) # Chai Wah Wu, Jul 09 2022
Formula
a(n) = 2*A131323(n) + 1.
a(n) = 4*A079523(n) + 3. - Charles R Greathouse IV, Aug 20 2013
a(n) ~ 12n. (In particular, a(n) = 12n + O(log n).) - Charles R Greathouse IV, Aug 20 2013
Comments