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 A261831 #25 Feb 24 2025 19:17:55 %S A261831 1,4,3,2,5,10,7,16,9,8,11,22,13,28,15,14,17,34,19,40,21,20,23,46,25, %T A261831 52,27,26,29,58,31,64,33,32,35,70,37,76,39,38,41,82,43,88,45,44,47,94, %U A261831 49,100,51,50,53,106,55,112,57,56,59,118,61,124,63,62,65,130,67,136,69,68,71,142,73,148,75,74,77,154,79,160,81,80 %N A261831 a(2*n-1) = 2*n-1; otherwise a(n) is the smallest even number not already present which is obtained from the existing terms by the rules of (3*n+1)-problem. %C A261831 By the rules of the (3*n+1)-problem, an even number can appear either by the operation 3*x+1 only when x is an odd number or by the division of a number of the form 4*k by 2. %C A261831 Using induction as in the proof of the Theorem in A261728, one can prove that if n == 0(mod 6), then a(n) = 2*n-2; if n == 2(mod 6), then a(n) = 2*n; if n == 4(mod 6), then a(n) = n-2. %C A261831 The sequence is a permutation of the positive integers not divisible by 6 (A047253). %H A261831 Peter J. C. Moses, <a href="/A261831/b261831.txt">Table of n, a(n) for n = 1..10000</a> %H A261831 <a href="/index/Rec#order_12">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,2,0,0,0,0,0,-1). %F A261831 a(2*n-1) = 2*n-1, for n>=1. %F A261831 a(6*k) = 12*k-2, a(6*k+2) = 12*k+4 and a(6*k+4) = 6*k+2, for k>=0. %F A261831 O.g.f.:(1+x (4+x (3+x (2+x (5+x (10+x (5+x (8+x (3+x (4+x (1+2 x)))))))))))/(-1+x^6)^2. %e A261831 Let n=28. Since 28 is of the form 6*k+4 with k=4, then a(28) = 6*4+2 = 26. %t A261831 a[n_] := If[OddQ[n], n, Switch[Mod[n, 6], 0, 2n-2, 2, 2n, 4, n-2]]; Array[a, 81] (* _Jean-François Alcover_, Sep 02 2015, from given formula *) %t A261831 LinearRecurrence[{0,0,0,0,0,2,0,0,0,0,0,-1},{1,4,3,2,5,10,7,16,9,8,11,22},90] (* _Harvey P. Dale_, Feb 24 2025 *) %Y A261831 Cf. A109732, A261690, A261728. %K A261831 nonn %O A261831 1,2 %A A261831 _Vladimir Shevelev_, Sep 02 2015