cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A108731 Triangle read by rows: row n gives digits of n in factorial base.

This page as a plain text file.
%I A108731 #49 Oct 02 2024 12:18:46
%S A108731 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,
%T A108731 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,
%U A108731 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
%N A108731 Triangle read by rows: row n gives digits of n in factorial base.
%C A108731 Row lengths are A084558. This sequence contains every finite sequence of nonnegative integers.
%C A108731 T(n,k)=A235168(n,k) for k=0..23; a(n) = A235168(n) for n=0..63, when both tables are seen as flattened lists. - _Reinhard Zumkeller_, Jan 05 2014
%H A108731 Reinhard Zumkeller, <a href="/A108731/b108731.txt">Rows n = 0..2000 of triangle, flattened</a>
%H A108731 C. A. Laisant, <a href="http://www.numdam.org/item?id=BSMF_1888__16__176_0">Sur la numération factorielle, application aux permutations</a>, Bulletin de la Société Mathématique de France, 16 (1888), p. 176-183.
%H A108731 Wikipedia, <a href="http://en.wikipedia.org/wiki/Factoradic">Factorial number system</a>
%H A108731 <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>
%e A108731 Triangle begins:
%e A108731   0
%e A108731   1
%e A108731   1, 0
%e A108731   1, 1
%e A108731   2, 0
%e A108731   2, 1
%e A108731   1, 0, 0
%e A108731 For example, 11 in factorial base is 121 (1*6 + 2*2 + 1*1), so row 11 is 1,2,1.
%p A108731 b:= proc(n, i) local r; `if`(n<i, [n],
%p A108731       [b(iquo(n, i, 'r'), i+1)[], r])
%p A108731     end:
%p A108731 T:= n-> b(n, 2)[]:
%p A108731 seq(T(n), n=0..50);  # _Alois P. Heinz_, Mar 19 2014
%t A108731 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 A108731 T[n_] := b[n, 2];
%t A108731 Table[T[n], {n, 0, 40}] // Flatten (* _Jean-François Alcover_, Feb 03 2018, after _Alois P. Heinz_ *)
%o A108731 (Haskell)
%o A108731 a108731 n k = a108731_row n !! k
%o A108731 a108731_row 0 = [0]
%o A108731 a108731_row n = t n $ reverse $ takeWhile (<= n) $ tail a000142_list
%o A108731    where t 0 []     = []
%o A108731          t x (b:bs) = x' : t m bs where (x',m) = divMod x b
%o A108731 a108731_tabf = map a108731_row [0..]
%o A108731 -- _Reinhard Zumkeller_, Jun 04 2012
%o A108731 (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
%o A108731 (Python)
%o A108731 def row(n, i=2): return [n] if n < i else [*row(n//i, i=i+1), n%i]
%o A108731 print([d for n in range(35) for d in row(n)]) # _Michael S. Branicky_, Oct 02 2024
%Y A108731 Cf: A000142, A007623, A084558, A301872.
%K A108731 easy,nonn,tabf,base
%O A108731 0,7
%A A108731 _Franklin T. Adams-Watters_, Jun 22 2005
%E A108731 Added a(0)=0 and offset changed accordingly by _Reinhard Zumkeller_, Jun 04 2012