OFFSET
1,2
COMMENTS
a(a(n))=n (a self-inverse permutation);
for n>1: a(n) = n iff n == 0 modulo 7.
LINKS
Eric Weisstein's World of Mathematics, Alternating Permutations
Reinhard Zumkeller, Illustration for A074066-A074068
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,1,-1).
FORMULA
a(n) = 7*floor(n/7) + 14*floor((n mod 7)/4) - (n mod 7) for n>3; a(n)=n for n<=3.
a(n) = a(n-1) + a(n-7) - a(n-8) for n > 11. - Chai Wah Wu, May 25 2016
g.f.: x+2*x^2+3*x^3 + x^4*(10-x-x^2-x^3-x^4-x^5-x^6+3*x^7) / ( (x^6+x^5+x^4+x^3+x^2+x+1)*(x-1)^2 ). - R. J. Mathar, May 22 2019
MATHEMATICA
Range[3]~Join~Flatten[Reverse /@ Partition[Range[4, 73], 7]] (* after Harvey P. Dale at A074066, or *)
Range[3]~Join~Table[7 Floor[n/7] + 14 Floor[#/4] - # &@ Mod[n, 7], {n, 4, 69}] (* Michael De Vlieger, May 25 2016 *)
PROG
(Haskell)
a074068 n = a074068_list !! (n-1)
a074068_list = 1 : 2 : 3 : xs where
xs = 10 : 9 : 8 : 7 : 6 : 5 : 4 : map (+ 7) xs
-- Reinhard Zumkeller, Feb 21 2011
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Reinhard Zumkeller, Aug 17 2002
STATUS
approved