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.

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

This page as a plain text file.
%I A067060 #30 Mar 14 2021 14:26:51
%S A067060 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 A067060 28,26,31,29,32,30,35,33,36,34,39,37,40,38,43,41,44,42,47,45,48,46,51,
%U A067060 49,52,50,55,53,56,54,59,57,60,58,63,61,64,62,67,65,68,66,71,69,72,70
%N A067060 A permutation of the positive integers in groups of four such that any two consecutive numbers differ by at least 2.
%C A067060 Start with the sequence of positive integers. Rearrange the sequence such that no two consecutive numbers are adjacent, by the following process:
%C A067060 Move 1 by the minimum number of steps required to the right.
%C A067060 Move 2 by the minimum number of steps required to the right. etc.
%C A067060 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 A067060 Initial sequence:  1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,...
%C A067060 after one step:    2,3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,...
%C A067060 after two steps:   3,1,4,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,...
%C A067060 after three steps: 3,1,4,2,6,7,5,8,9,10,11,12,13,14,15,16,17,18,19,...
%C A067060 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 A067060 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 A067060 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 A067060 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1).
%F A067060 From _Georg Fischer_, Apr 02 2019: (Start)
%F A067060 G.f.: (4*x^4 - x^3 - x^2 - x + 3) / ((x-1)^2*(x+1)*(x^2+1)).
%F A067060 a(n) = a(n-1) + a(n-4) - a(n-5) for n > 4. (End)
%t A067060 LinearRecurrence[{1, 0, 0, 1, -1}, {3, 1, 4, 2, 7}, 72] (* _Georg Fischer_, Apr 01 2019 *)
%o A067060 (Python) def a(n): return n+[-2,2,-1,1][n%4] # _Albert ten Oever_, Mar 27 2019
%o A067060 (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 A067060 a(n)=floor((n-1)/4)*4+([3,1,4,2][(n-1)%4+1]) \\ _Georg Fischer_, Apr 02 2019
%o A067060 (Perl 5) my @a = (3); my $n = 0;
%o A067060 while ($n < 72) {
%o A067060   push(@a, $a[$n ++] - 2); # 1
%o A067060   push(@a, $a[$n ++] + 3); # 4
%o A067060   push(@a, $a[$n ++] - 2); # 2
%o A067060   push(@a, $a[$n ++] + 5); # 7
%o A067060 } print join(",", @a); # _Georg Fischer_, Apr 01 2019
%Y A067060 Cf. A067061 (difference >= 3).
%K A067060 easy,nonn
%O A067060 1,1
%A A067060 _Amarnath Murthy_, Jan 03 2002
%E A067060 More terms from Larry Reeves (larryr(AT)acm.org), Apr 03 2002
%E A067060 Edited by _Georg Fischer_, Apr 01 2019