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!)
A067060 A permutation of the positive integers in groups of four such that any two consecutive numbers differ by at least 2. 5

%I #30 Mar 14 2021 14:26:51

%S 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,

%T 28,26,31,29,32,30,35,33,36,34,39,37,40,38,43,41,44,42,47,45,48,46,51,

%U 49,52,50,55,53,56,54,59,57,60,58,63,61,64,62,67,65,68,66,71,69,72,70

%N A permutation of the positive integers in groups of four such that any two consecutive numbers differ by at least 2.

%C Start with the sequence of positive integers. Rearrange the sequence such that no two consecutive numbers are adjacent, by the following process:

%C Move 1 by the minimum number of steps required to the right.

%C Move 2 by the minimum number of steps required to the right. etc.

%C 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.

%C Initial sequence: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,...

%C after one step: 2,3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,...

%C after two steps: 3,1,4,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,...

%C after three steps: 3,1,4,2,6,7,5,8,9,10,11,12,13,14,15,16,17,18,19,...

%C 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.

%C After two steps of the first algorithm, the group of the first four numbers satisfies 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.

%C 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*k-2 zeros>, 1, -1).

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1).

%F From _Georg Fischer_, Apr 02 2019: (Start)

%F G.f.: (4*x^4 - x^3 - x^2 - x + 3) / ((x-1)^2*(x+1)*(x^2+1)).

%F a(n) = a(n-1) + a(n-4) - a(n-5) for n > 4. (End)

%t LinearRecurrence[{1, 0, 0, 1, -1}, {3, 1, 4, 2, 7}, 72] (* _Georg Fischer_, Apr 01 2019 *)

%o (Python) def a(n): return n+[-2,2,-1,1][n%4] # _Albert ten Oever_, Mar 27 2019

%o (PARI) Vec((2*x^4-2*x^3+3*x^2-2*x+3)/((x-1)^2*(x^3+x^2+x+1)) + O(x^72)) \\ or

%o a(n)=floor((n-1)/4)*4+([3,1,4,2][(n-1)%4+1]) \\ _Georg Fischer_, Apr 02 2019

%o (Perl 5) my @a = (3); my $n = 0;

%o while ($n < 72) {

%o push(@a, $a[$n ++] - 2); # 1

%o push(@a, $a[$n ++] + 3); # 4

%o push(@a, $a[$n ++] - 2); # 2

%o push(@a, $a[$n ++] + 5); # 7

%o } print join(",", @a); # _Georg Fischer_, Apr 01 2019

%Y Cf. A067061 (difference >= 3).

%K easy,nonn

%O 1,1

%A _Amarnath Murthy_, Jan 03 2002

%E More terms from Larry Reeves (larryr(AT)acm.org), Apr 03 2002

%E Edited by _Georg Fischer_, Apr 01 2019

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 13:50 EDT 2024. Contains 371780 sequences. (Running on oeis4.)