%I #45 Sep 08 2022 08:44:57
%S 2,3,4,5,10,11,12,13,18,19,20,21,26,27,28,29,34,35,36,37,42,43,44,45,
%T 50,51,52,53,58,59,60,61,66,67,68,69,74,75,76,77,82,83,84,85,90,91,92,
%U 93,98,99,100,101,106,107,108,109,114,115,116,117,122,123
%N Numbers that are congruent to {2, 3, 4, 5} mod 8.
%C For n > 2, a(n) is the decimal value that results from the conversion of n-1 to binary whose last two bits are altered by either of the following rules: 00->010, 01->011, 10->100, 11->101. For example a(10) = 19 because 10 - 1 = 9 = '10'01'->'10'011' = 19. - _Franck Maminirina Ramaharo_, Jul 25 2018
%H Bruno Berselli, <a href="/A047596/b047596.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1).
%F G.f.: x*(2+x+x^2+x^3+3*x^4)/((1+x)*(1-x)^2*(1+x^2)). [_Bruno Berselli_, Jul 17 2012]
%F a(n) = 2*n-1-i^(n*(n+1))-(1+(-1)^n)/2, where i=sqrt(-1). [_Bruno Berselli_, Jul 17 2012]
%F a(n) = 2n - A010873(n-1). - _Wesley Ivan Hurt_, Jul 07 2013
%F From _Wesley Ivan Hurt_, Jun 01 2016: (Start)
%F a(n) = a(n-1) + a(n-4) - a(n-5) for n>5.
%F a(2k) = A047621(k), a(2k-1) = A047463(k). (End)
%F E.g.f.: 3 + sin(x) - cos(x) + (2*x - 1)*sinh(x) + 2*(x - 1)*cosh(x). - _Ilya Gutkovskiy_, Jun 02 2016
%F Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/16 - (sqrt(2)+3)*log(2)/8 + sqrt(2)*log(sqrt(2)+2)/4. - _Amiram Eldar_, Dec 25 2021
%p A047596:=n->2*n-1-I^(n*(n+1))-(1+I^(2*n))/2: seq(A047596(n), n=1..100); # _Wesley Ivan Hurt_, Jun 01 2016
%t Select[Range[120], MemberQ[{2, 3, 4, 5}, Mod[#, 8]] &] (* or *) LinearRecurrence[{1, 0, 0, 1, -1}, {2, 3, 4, 5, 10}, 60] (* _Bruno Berselli_, Jul 17 2012 *)
%o (Magma) [n: n in [1..120] | n mod 8 in [2..5]]; // _Bruno Berselli_, Jul 17 2012
%o (Maxima) makelist(2*n-1-%i^(n*(n+1))-(1+(-1)^n)/2,n,1,60); /* _Bruno Berselli_, Jul 17 2012 */
%o (PARI) Vec((2+x+x^2+x^3+3*x^4)/((1+x)*(1-x)^2*(1+x^2))+O(x^60)) \\ _Bruno Berselli_, Jul 17 2012
%o (GAP) Filtered([1..130],n->n mod 8=2 or n mod 8=3 or n mod 8=4 or n mod 8=5); # _Muniru A Asiru_, Jul 27 2018
%Y Cf. A010873, A047463, A047621.
%K nonn,easy
%O 1,1
%A _N. J. A. Sloane_