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.
%I A074066 #35 Feb 16 2025 08:32:46 %S A074066 1,4,3,2,7,6,5,10,9,8,13,12,11,16,15,14,19,18,17,22,21,20,25,24,23,28, %T A074066 27,26,31,30,29,34,33,32,37,36,35,40,39,38,43,42,41,46,45,44,49,48,47, %U A074066 52,51,50,55,54,53,58,57,56,61,60,59,64,63,62,67,66,65,70,69 %N A074066 Zigzag modulo 3. %C A074066 Take natural numbers, exchange trisections starting with 2 and 4. %H A074066 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/AlternatingPermutation.html">Alternating Permutations</a>. %H A074066 Reinhard Zumkeller, <a href="/A074066/a074066.ps">Illustration for A074066-A074068</a>. %H A074066 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,1,-1). %H A074066 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>. %F A074066 a(1)=1; for n>0: a(3*n-1) = 3*n+1, a(3*n) = 3*n, a(3*n+1) = 3*n-1. %F A074066 a(a(n))=n (self-inverse permutation); for n>1: a(n) = n iff n == 0 modulo 3. %F A074066 For n > 1: a(n) = 3*floor(n/3) + (n mod 3)^2 * (-1)^(n mod 3); a(1)=1. %F A074066 a(n) = a(n-1) + a(n-3) - a(n-4) for n > 5. - _Chai Wah Wu_, May 25 2016 %F A074066 For n > 1, a(n) = n - (4/sqrt(3))*sin(2*n*Pi/3). - _Wesley Ivan Hurt_, Sep 29 2017 %F A074066 g.f.: x + x^2*(4-x-x^2+x^3) / ( (1+x+x^2)*(x-1)^2 ). - _R. J. Mathar_, May 22 2019 %F A074066 Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) (A002162). - _Amiram Eldar_, Dec 24 2023 %t A074066 a[n_] := n + Mod[n, 3]*(3*Mod[n, 3] - 5); a[1] = 1; Table[a[n], {n, 1, 69}] (* _Jean-François Alcover_, Nov 04 2011 *) %t A074066 Join[{1},Flatten[Reverse/@Partition[Range[2,73],3]]] (* _Harvey P. Dale_, Feb 17 2012 *) %o A074066 (Haskell) %o A074066 a074066 n = a074066_list !! (n-1) %o A074066 a074066_list = 1 : xs where xs = 4 : 3 : 2 : map (+ 3) xs %o A074066 -- _Reinhard Zumkeller_, Feb 21 2011 %Y A074066 Cf. A002162, A064429, A074067, A074068. %K A074066 nonn,easy,nice %O A074066 1,2 %A A074066 _Reinhard Zumkeller_, Aug 17 2002