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.

A164287 Sequence resulting from an infinite series of reordering steps applied to the sequence of natural numbers A000027: At step n number n is moved from its position p to position p+k, where k is the actual number at position p+1.

Original entry on oeis.org

1, 3, 2, 4, 5, 8, 6, 7, 9, 12, 13, 10, 11, 16, 14, 17, 18, 15, 20, 24, 19, 25, 21, 22, 23, 31, 26, 34, 27, 33, 28, 37, 29, 38, 36, 30, 39, 32, 35, 46, 44, 47, 40, 48, 41, 42, 43, 49, 50, 53, 45, 58, 51, 59, 61, 52, 67, 54, 68, 55, 69, 56, 70, 57, 60, 73, 62, 63, 64, 65, 66, 80
Offset: 1

Views

Author

Eric Angelini and Alois P. Heinz, Aug 12 2009

Keywords

Comments

This sequence is a permutation of the natural numbers.

Crossrefs

Cf. A164286.

Programs

  • Maple
    mx:= 620: # increase mx to get more items
    l:= [i$i=1..2*mx]: pos:= proc(n) global l; local i; for i to nops(l) while l[i]<>n do od; `if`(i>nops(l), -1, i) end: for n from 1 to mx do p:= pos(n); k:= l[p+1]; l:= [l[1..p-1][], l[p+1..p+k][], l[p], l[p+k+1..nops(l)][]] od: p:= pos(mx+1): a:= n-> `if`(n
    				
  • Mathematica
    max = 200; r = Range[max]; For[n = 1, True, n++, p = Position[r, n]; If[p == {} || (q = p[[1, 1]] + r[[p[[1, 1]] + 1]] + 1) > max, Break[], c = r[[q]]; r = r /. {a___, n, b___, c, d___} :> {a, b, n, c, d}]]; A164287 = r[[1 ;; 72]] (* Jean-François Alcover, Jun 14 2012 *)