login
This site is supported by donations to The OEIS Foundation.

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A108731 Triangle read by rows: row n gives digits of n in factorial base. 12

%I

%S 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 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 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 Triangle read by rows: row n gives digits of n in factorial base.

%C Row lengths are A084558. This sequence contains every finite sequence of nonnegative integers.

%C 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 Reinhard Zumkeller, <a href="/A108731/b108731.txt">Rows n = 0..2000 of triangle, flattened</a>

%H 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 Wikipedia, <a href="http://en.wikipedia.org/wiki/Factoradic">Factorial number system</a>

%H <a href="/index/Fa#factorial">Index entries for sequences related to factorial numbers</a>

%e Triangle begins:

%e 0

%e 1

%e 1, 0

%e 1, 1

%e 2, 0

%e 2, 1

%e 1, 0, 0

%e For example, 11 in factorial base is 121 (1*6 + 2*2 + 1*1), so row 11 is 1,2,1.

%p b:= proc(n, i) local r; `if`(n<i, [n],

%p [b(iquo(n, i, 'r'), i+1)[], r])

%p end:

%p T:= n-> b(n, 2)[]:

%p seq(T(n), n=0..50); # _Alois P. Heinz_, Mar 19 2014

%t 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 T[n_] := b[n, 2];

%t Table[T[n], {n, 0, 40}] // Flatten (* _Jean-François Alcover_, Feb 03 2018, after _Alois P. Heinz_ *)

%o (Haskell)

%o a108731 n k = a108731_row n !! k

%o a108731_row 0 = [0]

%o a108731_row n = t n $ reverse $ takeWhile (<= n) $ tail a000142_list

%o where t 0 [] = []

%o t x (b:bs) = x' : t m bs where (x',m) = divMod x b

%o a108731_tabf = map a108731_row [0..]

%o -- _Reinhard Zumkeller_, Jun 04 2012

%o (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

%Y Cf: A000142, A007623, A084558, A301872.

%K easy,nonn,tabf,base

%O 0,7

%A _Franklin T. Adams-Watters_, Jun 22 2005

%E Added a(0)=0 and offset changed accordingly by _Reinhard Zumkeller_, Jun 04 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 17 23:15 EST 2019. Contains 319251 sequences. (Running on oeis4.)