login
A225822
Lesser of adjacent odd numbers with different parity of binary weight and both isolated from odd numbers of same parity of binary weight.
3
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,1
COMMENTS
Write the sequence of odious odd numbers above the sequence of evil odd numbers connecting all that are 2 apart:
1 7 11-13 19-21 25 31 35-37 41 47-49 55 59-61 67-69 73 79-81 87 91-93 97
3-5 9 15-17 23 27-29 33 39 43-45 51-53 57 63-65 71 75-77 83-85 89 95 99-
Remove the connected numbers:
1 7 25 31 41 55 73 87 97
9 23 33 39 57 71 89 95
Define these as "isolated".
The sequence is the smaller of the remaining pairs that are 2 apart.
The 1 is not a member since there is no change in parity between 1 and 7.
All of the differences between adjacent numbers in both the evil and odious sequences are either 2, 4 or 6, with 4 being the indicator that a transition in parity occurs. The program provided utilizes that fact to produce the sequence.
The sequence that includes all numbers along this path is A047522 (numbers congruent to {1,7} mod 8). This is also the same as the odd terms of A199398 (XOR of the first n odd numbers).
This sequence is similar to A044449 (numbers n such that string 1,3 occurs in the base 4 representation of n but not of n+1), but it contains additional terms. An example is 119. Its base 4 representation is 1313 while the base 4 representation of 120 is 1320. It may be that another workable definition of the sequence is -- numbers n in base 4 representation such that string 1,3 occurs one less time in n+1 than n, but I have not been able to check this.
The difference between the numbers in the sequence is always either 8 or 16, however there appears to be no recurring repetitions in it. Writing the 8 as a 0 and the 16 as a 1 (or dividing the difference pattern by 2 and subtracting a 1) produces a difference pattern of: 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1... which is an infinite word.
A similar process writing Even Odious over Even Evils produces 6, 22, 30, 38, 54, 70... which is twice A131323 (Odd numbers n such that the binary expansion ends in an even number of 1's), with all numbers along the path given by A047451 (numbers congruent to {0,6} mod 8) and yields the same difference pattern which produces the same infinite word.
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
MATHEMATICA
2*Select[Range[1, 320, 2], EvenQ[IntegerExponent[# + 1, 2]] &] + 1 (* Amiram Eldar, Jul 24 2023 *)
PROG
(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;
(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
CROSSREFS
Cf. A001969 (evil numbers), A129771 (odd evil numbers).
Cf. A000069 (odious numbers), A092246 (odd odious numbers).
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.
Sequence in context: A056723 A080802 A078515 * A044449 A095087 A144517
KEYWORD
nonn,base,easy
AUTHOR
Brad Clardy, Jul 30 2013
STATUS
approved