OdiousNumbers
The odious numbers : positive integers with an odd number of 1-bits.
OEIS
A000069OdiousNumbersthe with an odd binary popcount, an infinite indexed collection.Details
- A lazy indexed collection: , the complement of EvilNumbers among the positive integers. OEIS A000069.
- unranks by scanning forward -- .
- Membership goes through Element: is true (, three 1-bits), is false (EvilNumbers).
Definition
Epsil, as the implementation runs it.
count()
PositiveInfinityunrank(_r)
2 * _r + (1 - Fold(
Function([
(bt_s[1] - bt_s[1] % 2) / 2,
(bt_s[2] + bt_s[1] % 2) % 2,
], bt_s, bt_b),
[_r, 0],
Range(1, Floor(Log(_r + 1, 2)) + 2, 1),
)[2])rank(_x)
(_x - _x % 2) / 2 if _x >= 0 && Fold(
Function([
(bt_s[1] - bt_s[1] % 2) / 2,
(bt_s[2] + bt_s[1] % 2) % 2,
], bt_s, bt_b),
[_x, 0],
Range(1, Floor(Log(_x + 1, 2)) + 2, 1),
)[2] == 1 else -1valid(_x)
Fold(Function(
[(bt_s[1] - bt_s[1] % 2) / 2, (bt_s[2] + bt_s[1] % 2) % 2],
bt_s,
bt_b,
), [_x, 0], Range(1, Floor(Log(_x + 1, 2)) + 2, 1))[2] == 1 if _x >=
0 else FalseEnumeration
Examples
1 more kept as data, checked against the oraclesAbout
| Examples | 1 |
|---|---|
| Crosswalk | OEIS |
See also: Count, At, Element, EvilNumbers, PerniciousNumbers