|
|
A217266
|
|
Take the natural numbers, then for each k: move the multiples of k to the right.
|
|
1
|
|
|
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, 37, 20, 41, 34, 43, 32, 27, 28, 47, 35, 24, 38, 53, 30, 33, 59, 61, 46, 50, 39, 49, 67, 36, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
This is a permutation of the natural numbers.
|
|
LINKS
|
|
|
EXAMPLE
|
Before step 3, the intermediate sequence is:
1,3,2,5,4,7,6,9,8,11,10,13,12,15,14,17,16,19,18,21,20,23,22,...
We separate the multiples of 3 from the other numbers:
3, 6,9, 12,15, 18,21, ,...
1, 2,5,4,7, 8,11,10,13, 14,17,16,19, 20,23,22,...
We move the multiples of 3 to the right:
3,6, 9,12, 15,18, ,...
1, 2,5,4,7, 8,11,10,13, 14,17,16,19, 20,23,22,...
Thus, we obtain this intermediate sequence after step 3:
1,2,5,4,7,3,6,8,11,10,13,9,12,14,17,16,19,15,18,20,23,22,...
|
|
PROG
|
(Perl)
my $max = 1000;
my @a = (1..$max);
sub move {
my $k = shift;
my @res = ();
my @prev = ();
foreach (@_) {
if ($_ % $k==0) {
push @res => @prev;
@prev = ($_);
} else {
push @res => $_;
}
}
return @res;
}
foreach my $k (2..$max) {
@a = move($k => @a);
}
print join(", " => @a), "\n";
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|