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 A002517 #17 Aug 28 2016 18:23:33 %S A002517 0,2,3,6,5,12,9,8,21,18,11,30,15,14,39,36,17,48,27,20,57,24,23,66,63, %T A002517 26,75,54,29,84,33,32,93,90,35,102,45,38,111,42,41,120,117,44,129,108, %U A002517 47,138,51,50,147,144,53,156,81,56,165,60,59,174,171,62,183,72,65,192 %N A002517 Earliest sequence with a(a(n))=3n. %C A002517 a(3*n+1) = A016789(n), a(3*n+2) = A017197(n). - _Reinhard Zumkeller_, Jun 04 2015 %H A002517 T. D. Noe, <a href="/A002517/b002517.txt">Table of n, a(n) for n = 0..1000</a> %H A002517 <a href="/index/Aa#aan">Index entries for sequences of the a(a(n)) = 2n family</a> %F A002517 a(3n)=3*a(n), a(3n+1)=3n+2, a(3n+2)=9n+3 %t A002517 a[n_] := a[n] = Which[ Mod[n, 3] == 0, 3*a[n/3], Mod[n, 3] == 1, n+1, True, 3*(n-1)]; Table[a[n], {n, 0, 65}] (* _Jean-François Alcover_, Sep 24 2012 *) %o A002517 (Haskell) %o A002517 import Data.List (transpose) %o A002517 a002517 n = a002517_list !! n %o A002517 a002517_list = 0 : concat %o A002517 (transpose [[2, 5 ..], [3, 12 ..], map (* 3) $ tail a002517_list]) %o A002517 -- _Reinhard Zumkeller_, Jun 04 2015 %Y A002517 Cf. A002516, A007379, A005843. %Y A002517 Cf. A007494 (sorted), A016789, A017197. %K A002517 nonn,nice,easy %O A002517 0,2 %A A002517 _Colin Mallows_ %E A002517 Formula and more terms from _Henry Bottomley_, Apr 27 2000