OFFSET
1,2
COMMENTS
This is a list of the permutations in "one-line" notation (cf. Dixon and Mortimer, p. 2). The i-th element of the string is the image of i under the permutation. For example 231 is the permutation that sends 1 to 2, 2 to 3, and 3 to 1. - N. J. A. Sloane, Apr 12 2014
Precise definition of the term "Decimal representation" (required for indices n>409113): Numbers N(s) = Sum_{i=1..m} s(i)*10^(m-i), where s runs over the permutations of (1,...,m), and m=1,2,3,.... This also defines the "lexicographical" order: Obviously 21 comes before 123, etc. The lexicographical order of the permutations, for given m, is the same as the natural order of the numbers N(s). - M. F. Hasler, Jan 28 2013
An alternate variant, using concatenation of the permutations, is very clumsy once the length exceeds 9. For example, after 987654321 (= A030299(409113), where 409113 = A007489(9)) we would get 12345678910, 12345678109, ... In A030298 this problem has been avoided by listing the elements of permutations as separate terms. [Edited by M. F. Hasler, Dec 2012 and Jan 28 2013]
Sequence A051845 is a base-independent version of this sequence: Permutations of 1...m are considered as numbers written in base m+1. - M. F. Hasler, Jan 28 2013
REFERENCES
John D. Dixon and Brian Mortimer, Permutation groups. Graduate Texts in Mathematics, 163. Springer-Verlag, New York, 1996. xii+346 pp. ISBN: 0-387-94599-7 MR1409812 (98m:20003).
LINKS
MAPLE
seq(seq(add(s[i]*10^(m-i), i=1..m), s=combinat:-permute([$1..m])), m=1..5); # Robert Israel, Oct 14 2015
MATHEMATICA
Flatten @ Table[FromDigits /@ Permutations[Table[i, {i, n}]], {n, 9}] (* For first 409113 terms; Zak Seidov, Oct 03 2015 *)
PROG
(PARI) is_A030299(n)={ (n>1234567890 & print("maybe")) || vecsort(digits(n))==vector(#Str(n), i, i) } \\ /* use digits(n)=eval(Vec(Str(n))) in older versions lacking this function */ \\ M. F. Hasler, Dec 12 2012
(MIT/GNU Scheme from Antti Karttunen, Dec 18 2012):
(define (vector->base-k vec k) (let loop ((i 0) (s 0)) (cond ((= (vector-length vec) i) s) ((>= (vector-ref vec i) k) (error (format #f "Cannot interpret vector ~a in base ~a!" vec k))) (else (loop (+ i 1) (+ (* k s) (vector-ref vec i)))))))
(Python)
from itertools import permutations
def pmap(s, m): return sum(s[i-1]*10**(m-i) for i in range(1, len(s)+1))
def agen():
m = 1
while True:
for s in permutations(range(1, m+1)): yield pmap(s, m)
m += 1
def aupton(terms):
alst, g = [], agen()
while len(alst) < terms: alst += [next(g)]
return alst
print(aupton(42)) # Michael S. Branicky, Jan 12 2021
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
EXTENSIONS
Edited by N. J. A. Sloane, Feb 23 2010
STATUS
approved