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.
%I A134640 #22 Oct 21 2022 07:01:27 %S A134640 0,1,2,5,7,11,15,19,21,27,30,39,45,54,57,75,78,99,108,114,120,135,141, %T A134640 147,156,177,180,198,201,210,216,225,228,194,198,214,222,238,242,294, %U A134640 298,334,346,358,366,414,422,434,446,482,486,538,542,558,566,582,586 %N A134640 Permutational numbers (numbers with k different digits in k-positional system). %C A134640 Note that leading zeros are allowed in these numbers. %C A134640 a(1) is the 1-positional system 1!=1 numbers %C A134640 a(2) to a(3) are two=2! 2-positional system numbers %C A134640 a(4) to a(9) are six=3! 3-positional system numbers %C A134640 a(10) to a(33) are 24=4! 4-positional system numbers %C A134640 a(34) to a(153) are 120=5! 5-positional system numbers %C A134640 ... %C A134640 There are a(!k)-a(Sum[m!,1,k])=a(A003422)-a(A007489) k-positional system k! numbers %C A134640 The name permutational numbers arises because each permutation of k elements is isomorphic with one and only one of member of this sequence and conversely each number in this sequence is isomorphic with one and only one permutation of k elelmnts or its equivalent permutation matrix. %C A134640 T(n,1) = A023811(n); T(n,A000142(n)) = A062813(n). - _Reinhard Zumkeller_, Aug 29 2014 %H A134640 Reinhard Zumkeller, <a href="/A134640/b134640.txt">Rows n = 1..7 of triangle, flattened</a> %e A134640 We build permutational numbers: %e A134640 a(1)=0 in unitary positional system we have only one digit 0 %e A134640 a(2)=1 because in binary positional system smaller number with two different digits is 01 = 1 %e A134640 a(3)=2 because in binary positional system bigger number with two different digits is 10 = 2 (binary system is over) %e A134640 a(4)=5 because smallest number in ternary system with 3 different digits is 012=5 %e A134640 a(5)=7 second number in ternary system with 3 different digits is 021=7 %e A134640 a(6)=11 third number in ternary system with 3 different digits is 102=11 %e A134640 a(7)=15 120=15 %e A134640 etc. %t A134640 a = {}; b = {}; Do[AppendTo[b, n]; w = Permutations[b]; Do[j = FromDigits[w[[m]], n + 1]; AppendTo[a, j], {m, 1, Length[w]}], {n, 0, 5}]; a (*Artur Jasinski*) %t A134640 Flatten[Table[FromDigits[#,n]&/@Permutations[Range[0,n-1]],{n,5}]] (* _Harvey P. Dale_, Dec 09 2014 *) %o A134640 (Haskell) %o A134640 import Data.List (permutations, sort) %o A134640 a134640 n k = a134640_tabf !! (n-1) !! (k-1) %o A134640 a134640_row n = sort $ %o A134640 map (foldr (\dig val -> val * n + dig) 0) $ permutations [0 .. n - 1] %o A134640 a134640_tabf = map a134640_row [1..] %o A134640 a134640_list = concat a134640_tabf %o A134640 -- _Reinhard Zumkeller_, Aug 29 2014 %o A134640 (Python) %o A134640 from itertools import permutations %o A134640 def fd(d, b): return sum(di*b**i for i, di in enumerate(d[::-1])) %o A134640 def row(n): return [fd(d, n) for d in permutations(range(n))] %o A134640 print([an for r in range(1, 6) for an in row(r)]) # _Michael S. Branicky_, Oct 21 2022 %Y A134640 Cf. A003422, A007489, A061845, A000142 (row lengths excluding 1st term). %Y A134640 Cf. A023811, A062813, A000142 (row lengths), A007489 (sums of row lengths). %K A134640 nonn,base,tabf %O A134640 1,3 %A A134640 _Artur Jasinski_, Nov 05 2007, Nov 07 2007, Nov 08 2007 %E A134640 Corrected indices in examples. Replaced dashes in comments by the word "to" - _R. J. Mathar_, Aug 26 2009