FubiniNumbers
The Fubini numbers (ordered Bell numbers) as a lazy indexed collection.
OEIS
A000670SageMathOrderedSetPartitions(n)FubiniNumbersThe number of ordered set partitions (rankings with ties allowed) of an -set, an infinite indexed collection.Details
- A lazy indexed collection: , and unranks term via , bigint throughout -- .
- OEIS A000670, starting exactly at its offset-0 term: .
- Membership goes through Element: is true, is false.
Definition
Epsil, as the implementation runs it.
count()
PositiveInfinityunrank(_r)
Apply((hs_l: integer) => Apply((hs_n: integer) => Fold(
Function(hs_t if False else Join(
hs_t,
[Fold(
Function(hs_a +
Binomial(hs_m, hs_j - 1) *
hs_t[hs_j], hs_a, hs_j),
0,
Range(1, hs_m, 1),
)],
), hs_t, hs_m),
[1],
Range(1, hs_l, 1),
), 0), _r)[_r + 1]rank(_x)
Apply((hs_b: integer) => Apply(
(hs_all: list<integer>) => Fold(
Function(
(hs_i if hs_p < 0 &&
hs_all[hs_i + 1] ==
_x else hs_p) if hs_i < Length(hs_all) else hs_p,
hs_p,
hs_i,
),
-1,
Range(
0,
hs_b,
1,
),
),
Apply((hs_l: integer) => Apply((hs_n: integer) => Fold(
Function(
hs_t if hs_t[Length(hs_t)] > _x else Join(hs_t, [Fold(Function(hs_a +
Binomial(hs_m, hs_j - 1) *
hs_t[hs_j], hs_a, hs_j), 0, Range(1, hs_m, 1))]),
hs_t,
hs_m,
),
[1],
Range(1, hs_l, 1),
), 0), hs_b),
), Apply(
(fl_r: list<integer>) => fl_r[2],
Fold(Function(
[(fl_s[1] - fl_s[1] % 2 ^
fl_k) /
2 ^ fl_k, fl_s[2] + fl_k] if fl_s[1] >=
2 ^
fl_k else fl_s,
fl_s,
fl_k,
), [_x + 2, 0], [
8_192,
4_096,
2_048,
1_024,
512,
256,
128,
64,
32,
16,
8,
4,
2,
1,
]),
) + 3) if _x >= 0 else -1valid(_x)
Apply((hs_b: integer) => Apply(
(hs_all: list<integer>) => Fold(
Function(
(hs_i if hs_p < 0 &&
hs_all[hs_i + 1] ==
_x else hs_p) if hs_i < Length(hs_all) else hs_p,
hs_p,
hs_i,
),
-1,
Range(
0,
hs_b,
1,
),
),
Apply((hs_l: integer) => Apply((hs_n: integer) => Fold(
Function(
hs_t if hs_t[Length(hs_t)] > _x else Join(hs_t, [Fold(Function(hs_a +
Binomial(hs_m, hs_j - 1) *
hs_t[hs_j], hs_a, hs_j), 0, Range(1, hs_m, 1))]),
hs_t,
hs_m,
),
[1],
Range(1, hs_l, 1),
), 0), hs_b),
), Apply(
(fl_r: list<integer>) => fl_r[2],
Fold(Function(
[(fl_s[1] - fl_s[1] % 2 ^
fl_k) /
2 ^ fl_k, fl_s[2] + fl_k] if fl_s[1] >=
2 ^
fl_k else fl_s,
fl_s,
fl_k,
), [_x + 2, 0], [
8_192,
4_096,
2_048,
1_024,
512,
256,
128,
64,
32,
16,
8,
4,
2,
1,
]),
) + 3) >= 0 if _x >= 0 else FalseEnumeration
Examples
1 more kept as data, checked against the oracles See also: Count, At, Element, BellNumbers