PowersOfTwo
The powers of two — subsets of an -set; row-sums of Pascal's triangle.
OEIS
A000079PowersOfTwo for .Details
Definition
Epsil, as the implementation runs it.
count()
PositiveInfinityunrank(_r)
2 ^ _rrank(_x)
Apply(
(sq_at: integer) => sq_at if 2 ^ sq_at == _x else -1,
Fold(Function(
sq_at + 2 ^ sq_b if 2 ^ (sq_at + 2 ^ sq_b) <= _x else sq_at,
sq_at,
sq_b,
), 0, Range(Floor(Log(Floor(Log(_x, 2)) + 2, 2)) + 1, 0, -1)),
) if True else -1valid(_x)
Apply(
(sq_at: integer) => 2 ^ sq_at == _x,
Fold(Function(
sq_at + 2 ^ sq_b if 2 ^ (sq_at + 2 ^ sq_b) <= _x else sq_at,
sq_at,
sq_b,
), 0, Range(Floor(Log(Floor(Log(_x, 2)) + 2, 2)) + 1, 0, -1)),
) if True && _x >= 1 else FalseEnumeration
Examples
1 more kept as data, checked against the oraclesAbout
| Examples | 3 |
|---|---|
| Crosswalk | OEIS |
See also: Subsets, FactorialNumbers, Count, At, Element