|
|
A108731
|
|
Triangle read by rows: row n gives digits of n in factorial base.
|
|
44
|
|
|
0, 1, 1, 0, 1, 1, 2, 0, 2, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 0, 1, 2, 1, 2, 0, 0, 2, 0, 1, 2, 1, 0, 2, 1, 1, 2, 2, 0, 2, 2, 1, 3, 0, 0, 3, 0, 1, 3, 1, 0, 3, 1, 1, 3, 2, 0, 3, 2, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 2, 0, 1, 0, 2, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,7
|
|
COMMENTS
|
Row lengths are A084558. This sequence contains every finite sequence of nonnegative integers.
|
|
LINKS
|
|
|
EXAMPLE
|
Triangle begins:
0
1
1, 0
1, 1
2, 0
2, 1
1, 0, 0
For example, 11 in factorial base is 121 (1*6 + 2*2 + 1*1), so row 11 is 1,2,1.
|
|
MAPLE
|
b:= proc(n, i) local r; `if`(n<i, [n],
[b(iquo(n, i, 'r'), i+1)[], r])
end:
T:= n-> b(n, 2)[]:
|
|
MATHEMATICA
|
b[n_, i_] := b[n, i] = Module[{q, r}, If[n < i, {n}, {q, r} = QuotientRemainder[n, i]; Append[b[q, i + 1], r]]];
T[n_] := b[n, 2];
|
|
PROG
|
(Haskell)
a108731 n k = a108731_row n !! k
a108731_row 0 = [0]
a108731_row n = t n $ reverse $ takeWhile (<= n) $ tail a000142_list
where t 0 [] = []
t x (b:bs) = x' : t m bs where (x', m) = divMod x b
a108731_tabf = map a108731_row [0..]
(PARI) A108731_row(n)={n=[n]; while(n[1], n=concat(divrem(n[1], 1+#n), n[^1]); n[1]||break); n[^1]~} \\ M. F. Hasler, Jun 20 2017
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn,tabf,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|