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.

A178475 Permutations of 12345: Numbers having each of the decimal digits 1,...,5 exactly once, and no other digit.

This page as a plain text file.
%I A178475 #29 Jul 04 2019 03:32:58
%S A178475 12345,12354,12435,12453,12534,12543,13245,13254,13425,13452,13524,
%T A178475 13542,14235,14253,14325,14352,14523,14532,15234,15243,15324,15342,
%U A178475 15423,15432,21345,21354,21435,21453,21534,21543,23145,23154,23415
%N A178475 Permutations of 12345: Numbers having each of the decimal digits 1,...,5 exactly once, and no other digit.
%C A178475 There are 5! = 120 terms in this finite subsequence of A030299.
%C A178475 It would be interesting to conceive simple and/or efficient functions which yield (a) the n-th term of this sequence: f(n) = a(n), (b) for a given term, the subsequent one: f(a(n)) = a(1 + (n mod 5!)).
%C A178475 From _Nathaniel Johnston_, May 19 2011: (Start)
%C A178475 Individual terms a(n) can be computed efficiently via the following procedure: Define b(n,k) = 1 + floor(((n-1) mod (k+1)!)/k!) for k = 1, 2, 3, 4. The first digit of a(n) is b(n,4). The second digit of a(n) is the b(n,3)-th number not already used. The third digit of a(n) is the b(n,2)-th number not already used. The fourth digit of a(n) is the b(n,1)-th number not already used, and the final digit of a(n) is the only digit remaining. This procedure generalizes in the obvious way for related sequences such as A178476.
%C A178475 For example, if n = 38 then we compute b(38,1) = 2, b(38,2) = 1, b(38,3) = 3, b(38,4) = 2. Thus a(38) = 24153 (2, followed by the 3rd digit not yet used, followed by the 1st digit not yet used, followed by the 2nd digit not yet used, followed by the last remaining digit).
%C A178475 (End)
%H A178475 Nathaniel Johnston, <a href="/A178475/b178475.txt">Table of n, a(n) for n = 1..120</a> (full sequence)
%F A178475 a(n) + a(5! + 1 - n) = 66666.
%F A178475 floor( a(n) / 10^4 ) = ceiling( n / 4! ).
%F A178475 a(n) = A030299(n+33).
%F A178475 a(n) == 6 (mod 9).
%F A178475 a(n) = 6 + 9*A178485(n).
%t A178475 FromDigits/@Permutations[Range[5]] (* _Harvey P. Dale_, Jan 19 2019 *)
%o A178475 (PARI) A178475(n)={my(b=vector(4,k,1+(n-1)%(k+1)!\k!),t=b[4],d=vector(4,i,i+(i>=t)));for(i=1,3,t=10*t+d[b[4-i]];d=vecextract(d,Str("^"b[4-i])));t*10+d[1]} \\ - _M. F. Hasler_ (following N. Johnston's comment), Jan 10 2012
%o A178475 (PARI) v=vector(5,i,10^(i-1))~; A178475=vecsort(vector(5!,i,numtoperm(5,i)*v))
%o A178475 is_A178475(x)={ vecsort(Vecsmall(Str(x)))==Vecsmall("12345") }
%o A178475 forstep( m=12345,54321,9, is_A178475(m) & print1(m","))
%Y A178475 Cf. A030298, A030299, A055089, A060117, A178476.
%K A178475 fini,full,easy,nonn,base
%O A178475 1,1
%A A178475 _M. F. Hasler_, May 28 2010