login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A213890 For any n >= 0, write all permutations of {0,1,...,n} in reverse lexicographic order. The last elements of the permutations will be the initial terms of this sequence. 1
0, 1, 0, 2, 1, 2, 0, 1, 0, 3, 1, 3, 0, 2, 0, 3, 2, 3, 1, 2, 1, 3, 2, 3, 0, 1, 0, 2, 1, 2, 0, 1, 0, 4, 1, 4, 0, 2, 0, 4, 2, 4, 1, 2, 1, 4, 2, 4, 0, 1, 0, 3, 1, 3, 0, 1, 0, 4, 1, 4, 0, 3, 0, 4, 3, 4, 1, 3, 1, 4, 3, 4, 0, 2, 0, 3, 2, 3, 0, 2, 0, 4, 2, 4, 0, 3, 0, 4, 3, 4, 2, 3, 2, 4, 3, 4, 1, 2, 1, 3, 2, 3, 1, 2, 1, 4, 2, 4, 1, 3, 1, 4, 3, 4, 2, 3, 2, 4, 3, 4, 0, 1, 0, 2, 1, 2, 0, 1, 0, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
a(A007489(n)) = n is the first occurrence of n in the sequence.
LINKS
David W. Wilson, C++ function to efficiently compute a(n).
EXAMPLE
For n = 2, the permutations of {0,1,2} in reverse lexical order are: (2,1,0),(2,0,1),(1,2,0),(1,0,2),(0,2,1),(0,1,2). The final elements of these permutations are 0,1,0,2,1,2 which are the initial terms of this sequence. The same holds for any n >= 0.
MAPLE
a:= proc(n) local h, k, m;
h, k:= n, 0;
for m from 2 while h>0 do
k:= k+ `if`(irem(h, m, 'h')+k+1 < m, 0, 1)
od; k
end:
seq(a(n), n=0..130); # Alois P. Heinz, Jun 23 2012
MATHEMATICA
a[n_] := Module[{h, k, m, r}, h = n; k = 0; For[m = 2, h>0, m++, k = k + If[{h, r} = QuotientRemainder[h, m ]; r+k+1 < m, 0, 1]]; k]; Table[a[n], {n, 0, 130}] (* Jean-François Alcover, Jun 11 2015, after Alois P. Heinz *)
CROSSREFS
Sequence in context: A125925 A340795 A137853 * A226460 A358360 A094114
KEYWORD
nonn
AUTHOR
David W. Wilson, Jun 23 2012
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 18:20 EDT 2024. Contains 371781 sequences. (Running on oeis4.)