login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A217266 Take the natural numbers, then for each k: move the multiples of k to the right. 1

%I

%S 1,2,3,4,5,7,6,8,11,13,9,10,17,12,19,14,23,16,15,25,29,31,22,26,18,21,

%T 37,20,41,34,43,32,27,28,47,35,24,38,53,30,33,59,61,46,50,39,49,67,36,

%U 44,71,58,73,55,51,79,52,62,83,40,42,89,65,74,45,97,57,101,56,82,103,68,76,64,88,107,109,86,113,48,70,69,54,75,81,94,63,77

%N Take the natural numbers, then for each k: move the multiples of k to the right.

%C This is a permutation of the natural numbers.

%H Paul Tek, <a href="/A217266/b217266.txt">Table of n, a(n) for n = 1..10000</a>

%e Before step 3, the intermediate sequence is:

%e 1,3,2,5,4,7,6,9,8,11,10,13,12,15,14,17,16,19,18,21,20,23,22,...

%e We separate the multiples of 3 from the other numbers:

%e 3, 6,9, 12,15, 18,21, ,...

%e 1, 2,5,4,7, 8,11,10,13, 14,17,16,19, 20,23,22,...

%e We move the multiples of 3 to the right:

%e 3,6, 9,12, 15,18, ,...

%e 1, 2,5,4,7, 8,11,10,13, 14,17,16,19, 20,23,22,...

%e Thus, we obtain this intermediate sequence after step 3:

%e 1,2,5,4,7,3,6,8,11,10,13,9,12,14,17,16,19,15,18,20,23,22,...

%o (Perl)

%o my $max = 1000;

%o my @a = (1..$max);

%o sub move {

%o my $k = shift;

%o my @res = ();

%o my @prev = ();

%o foreach (@_) {

%o if ($_ % $k==0) {

%o push @res => @prev;

%o @prev = ($_);

%o } else {

%o push @res => $_;

%o }

%o }

%o return @res;

%o }

%o foreach my $k (2..$max) {

%o @a = move($k => @a);

%o }

%o print join("," => @a), "\n";

%K nonn

%O 1,2

%A _Paul Tek_, Mar 17 2013

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 17 12:55 EDT 2021. Contains 343971 sequences. (Running on oeis4.)