

A067060


A permutation of the natural numbers in groups of four such that any two consecutive numbers differ by at least 2.


5



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



OFFSET

1,1


COMMENTS

Start with the sequence of natural numbers. Rearrange the sequence such that no two consecutive numbers are adjacent, by the following process:
Move 1 by the minimum number of steps required to the right.
Move 2 by the minimum number of steps required to the right. etc.
In general, move the first element which is required to be moved by the minimum number of steps in the sequence obtained by the previous step.
Initial sequence: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,...
after one step: 2,3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,...
after two steps: 3,1,4,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,...
after three steps: 3,1,4,2,6,7,5,8,9,10,11,12,13,14,15,16,17,18,19,...
Alternative algorithm: Start with 3. Decrease by 2 then increase by 3 then decrease by 2 to obtain the first four terms, and increase the fourth term by 5 to obtain the new start. Repeat the process to get the subsequent terms.
After two steps of the first algorithm, the group of the first four numbers fulfills the condition, and the difference between the fourth term and the fifth is 3. Therefore the sequence continues with the same permutation of the next four terms.
For a required difference of at least 3 (see A067061), the same argument leads permutations in groups of 6 terms. In general, a required difference of at least k leads to permutations in groups of 2*k, and a linear recurrence equation with signature (1, <2*k2 zeros>, 1, 1).


LINKS

Table of n, a(n) for n=1..72.
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,1).


FORMULA

From Georg Fischer, Apr 02 2019: (Start)
G.f.: (4*x^4  x^3  x^2  x + 3) / ((x1)^2*(x+1)*(x^2+1)).
a(n) = a(n1) + a(n4)  a(n5) for n > 4. (End)


MATHEMATICA

LinearRecurrence[{1, 0, 0, 1, 1}, {3, 1, 4, 2, 7}, 72] (* Georg Fischer, Apr 01 2019 *)


PROG

(Python) def a(n): return n+[2, 2, 1, 1][n%4] # Albert ten Oever, Mar 27 2019
(PARI) Vec((2*x^42*x^3+3*x^22*x+3)/((x1)^2*(x^3+x^2+x+1)) + O(x^72)) \\ or
a(n)=floor((n1)/4)*4+([3, 1, 4, 2][(n1)%4+1]) \\ Georg Fischer, Apr 02 2019
(Perl 5) my @a = (3); my $n = 0;
while ($n < 72) {
push(@a, $a[$n ++]  2); # 1
push(@a, $a[$n ++] + 3); # 4
push(@a, $a[$n ++]  2); # 2
push(@a, $a[$n ++] + 5); # 7
} print join(", ", @a); # Georg Fischer, Apr 01 2019


CROSSREFS

Cf. A067061 (difference >= 3).
Sequence in context: A273261 A274531 A115659 * A068028 A240058 A275896
Adjacent sequences: A067057 A067058 A067059 * A067061 A067062 A067063


KEYWORD

easy,nonn


AUTHOR

Amarnath Murthy, Jan 03 2002


EXTENSIONS

More terms from Larry Reeves (larryr(AT)acm.org), Apr 03 2002
Edited by Georg Fischer, Apr 01 2019


STATUS

approved



