login
Numbers that are congruent to {0, 2, 5, 7} mod 8.
2

%I #43 Sep 08 2022 08:44:57

%S 0,2,5,7,8,10,13,15,16,18,21,23,24,26,29,31,32,34,37,39,40,42,45,47,

%T 48,50,53,55,56,58,61,63,64,66,69,71,72,74,77,79,80,82,85,87,88,90,93,

%U 95,96,98,101,103,104,106,109,111,112,114,117,119,120,122,125

%N Numbers that are congruent to {0, 2, 5, 7} mod 8.

%C Complement of A047415.

%H Vincenzo Librandi, <a href="/A047481/b047481.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,-2,2,-1).

%F From _Colin Barker_, May 14 2012: (Start)

%F a(n) = (1/4+i/4)*((-3+3*i)-i*(-i)^n+i^n+(4-4*i)*n) where i=sqrt(-1).

%F G.f.: x^2*(2+x+x^2)/((1-x)^2*(1+x^2)). (End)

%F a(n) = 2*a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) for n>4. - _Vincenzo Librandi_, May 16 2012

%F a(n) = (-1*((-1)^((n-1)/2-(-1)^n/4-1/4)))/2+2*(n-1)+1/2.

%F a(n) = cos(n*Pi/2)-1/2*cos((n-1)*Pi/2)-1/2*cos(n*Pi/2)+2*(n-1)+1/2. - _Cédric Christian Bernard Gagneux_, Mar 05 2014

%F a(2k) = A047524, a(2k-1) = A047615(k). - _Wesley Ivan Hurt_, Jun 01 2016

%F E.g.f.: (2 - sin(x) + cos(x) + (4*x - 3)*exp(x))/2. - _Ilya Gutkovskiy_, Jun 02 2016

%F Sum_{n>=2} (-1)^n/a(n) = (3-sqrt(2))*log(2)/8 + sqrt(2)*log(2+sqrt(2))/4 - Pi/16. - _Amiram Eldar_, Dec 21 2021

%p A047481:=n->(-1*((-1)^((n-1)/2-(-1)^n/4-1/4)))/2+2*(n-1)+1/2: seq(A047481(n), n=1..100); # _Wesley Ivan Hurt_, Jun 01 2016

%t Select[Range[0,300], MemberQ[{0,2,5,7}, Mod[#,8]]&] (* _Vincenzo Librandi_, May 16 2012 *)

%t LinearRecurrence[{2,-2,2,-1},{0,2,5,7},70] (* _Harvey P. Dale_, May 28 2017 *)

%o (Magma) I:=[0, 2, 5, 7, 8]; [n le 5 select I[n] else Self(n-1)+Self(n-4)-Self(n-5): n in [1..70]]; // _Vincenzo Librandi_, May 16 2012

%o (PARI) a(n)=[-1,0,2,5][n%4]+n\4*8 \\ _Charles R Greathouse IV_, Mar 05 2014

%o (PARI) x='x+O('x^100); concat(0, Vec(x^2*(2+x+x^2)/((1-x)^2*(1+x^2)))) \\ _Altug Alkan_, Dec 24 2015

%Y Cf. A047415, A047524, A047615.

%K nonn,easy

%O 1,2

%A _N. J. A. Sloane_