A067060 A permutation of the positive integers in groups of four such that any two consecutive numbers differ by at least 2.
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
Offset: 1
Links
- Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
Crossrefs
Cf. A067061 (difference >= 3).
Programs
-
Mathematica
LinearRecurrence[{1, 0, 0, 1, -1}, {3, 1, 4, 2, 7}, 72] (* Georg Fischer, Apr 01 2019 *)
-
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 a(n)=floor((n-1)/4)*4+([3,1,4,2][(n-1)%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
-
Python
def a(n): return n+[-2,2,-1,1][n%4] # Albert ten Oever, Mar 27 2019
Formula
From Georg Fischer, Apr 02 2019: (Start)
G.f.: (4*x^4 - x^3 - x^2 - x + 3) / ((x-1)^2*(x+1)*(x^2+1)).
a(n) = a(n-1) + a(n-4) - a(n-5) for n > 4. (End)
Extensions
More terms from Larry Reeves (larryr(AT)acm.org), Apr 03 2002
Edited by Georg Fischer, Apr 01 2019
Comments