|
|
A007623
|
|
Integers written in factorial base.
(Formerly M4678)
|
|
245
|
|
|
0, 1, 10, 11, 20, 21, 100, 101, 110, 111, 120, 121, 200, 201, 210, 211, 220, 221, 300, 301, 310, 311, 320, 321, 1000, 1001, 1010, 1011, 1020, 1021, 1100, 1101, 1110, 1111, 1120, 1121, 1200, 1201, 1210, 1211, 1220, 1221, 1300, 1301, 1310, 1311, 1320, 1321, 2000, 2001, 2010
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Places reading from right have values (1, 2, 6, 24, 120, ...) = factorials.
Also the reversed inversion vectors for the list of all finite permutations in reversed lexicographic order: A055089.
This concatenated representation is unsatisfactory for large n (above 36287999), when coefficients of 10 or greater start to appear. For these large numbers the representation given in A108731 is better. - N. J. A. Sloane, Jun 04 2012
For n = 36288000 = 10 * 10!, the digits in factorial base are {10, 0, 0, 0, 0, 0, 0, 0, 0, 0}. - Michael De Vlieger, Oct 11 2015, corrected and edited by M. F. Hasler, Nov 27 2018
The alt text in xkcd comic #2835 describes "Numbers larger than about 3.6 million" to be illegal. See links. - David Cleaver, Sep 30 2023
|
|
REFERENCES
|
D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 2, p. 192.
F. Smarandache, Definitions solved and unsolved problems, conjectures and theorems in number theory and geometry, edited by M. Perez, Xiquan Publishing House, 2000.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
|
|
EXAMPLE
|
a(47) = 1321 because 47 = 1*4! + 3*3! + 2*2! + 1*1!
|
|
MAPLE
|
a := n -> if nargs<2 then a(n, 2) elif n<args[2] then n else a(iquo(n, args[2]), args[2]+1)*10+irem(n, args[2]) fi: 'a(i)'$i=0..200;
|
|
MATHEMATICA
|
factBaseIntDs[n_] := Module[{m, i, len, dList, currDigit}, i = 1; While[n > i!, i++ ]; m = n; len = i; dList = Table[0, {len}]; Do[ currDigit = 0; While[m >= j!, m = m - j!; currDigit++ ]; dList[[len - j + 1]] = currDigit, {j, i, 1, -1}]; If[dList[[1]] == 0, dList = Drop[dList, 1]]; dList]; Table[FromDigits[factBaseIntDs[n]], {n, 0, 50}] (* Alonso del Arte, May 03 2006 *)
lim = 50; m = 1; While[Factorial@ m < lim, m++]; m; IntegerDigits[#, MixedRadix[Reverse@ Range[2, m]]] & /@ Range@ lim (* Michael De Vlieger, Oct 11 2015, Version 10.2 *)
|
|
PROG
|
(PARI) apply( a(n, p=2)=if(n<p, n, a(n\p, p+1)*10 + n%p), [0..199]) \\ M. F. Hasler, Mar 27 2007; minor edit Nov 26 2018
(Haskell)
a007623 n | n <= 36287999 = read $ concatMap show (a108731_row n) :: Int
| otherwise = error "representation would be ambiguous"
(Scheme, R6RS standard) (define (A007623 n) (let loop ((n n) (s 0) (p 1) (i 2)) (if (zero? n) s (let ((d (mod n i))) (loop (/ (- n d) i) (+ (* p d) s) (* 10 p) (+ 1 i)))))) ;; In older Schemes use modulo instead of mod. - Antti Karttunen, Feb 13 2016
(Python)
def a(n, p=2): return n if n<p else a(n//p, p+1)*10 + n%p
print([a(n - 1) for n in range(1, 201)]) # Indranil Ghosh, Jun 19 2017, after PARI program
(APL, Dyalog dialect) A007623 ← {⍺←2 ⋄ ⍵<⍺: ⍵ ⋄ (⍺|⍵) + ((⍺+1) ∇ ⍺(⌊÷⍨)⍵)×10} ⍝ (code from Dani Adham) - Antti Karttunen, Feb 20 2024
|
|
CROSSREFS
|
Cf. A060130 (number of nonzero digits).
Cf. A099563 (the most significant digit).
See index entry "factorial base representation" for many more related sequences.
Compare also to primorial base A049345.
|
|
KEYWORD
|
base,nonn,nice,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|