login
Numbers that are congruent to {0, 1, 2, 4, 6} mod 8.
2

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

%S 0,1,2,4,6,8,9,10,12,14,16,17,18,20,22,24,25,26,28,30,32,33,34,36,38,

%T 40,41,42,44,46,48,49,50,52,54,56,57,58,60,62,64,65,66,68,70,72,73,74,

%U 76,78,80,81,82,84,86,88,89,90,92,94,96,97,98,100,102,104,105

%N Numbers that are congruent to {0, 1, 2, 4, 6} mod 8.

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

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

%F G.f.: x^2*(1+x+2*x^2+2*x^3+2*x^4) / ( (x^4+x^3+x^2+x+1)*(x-1)^2 ). - _R. J. Mathar_, Dec 05 2011

%F From _Wesley Ivan Hurt_, Aug 08 2016: (Start)

%F a(n) = a(n-1) + a(n-5) - a(n-6) for n > 6.

%F a(n) = a(n-5) + 8 for n > 5.

%F a(n) = (40*n - 55 - 2*(n mod 5) - 2*((n+1) mod 5) + 3*((n+2) mod 5) + 3*((n+3) mod 5) - 2*((n+4) mod 5))/25.

%F a(5*k) = 8*k-2, a(5*k-1) = 8*k-4, a(5*k-2) = 8*k-6, a(5*k-3) = 8*k-7, a(5*k-4) = 8*k-8. (End)

%F a(n) = (40*n-55+6*cos(2*Pi*(n-1)/5)+2*cos(2*Pi*n/5)+2*cos(4*Pi*n/5)-2*cos(2*Pi*(n+1)/5)-6*cos(Pi*(4*n+1)/5)+6*sin(Pi*(4*n+3)/10)+2*sin(Pi*(8*n+3)/10)-6*sin(Pi*(8*n+1)/10))/25. - _Wesley Ivan Hurt_, Oct 10 2018

%p A047412:=n->8*floor(n/5)+[(0, 1, 2, 4, 6)][(n mod 5)+1]: seq(A047412(n), n=0..100); # _Wesley Ivan Hurt_, Aug 08 2016

%t Flatten[Table[8*n + {0, 1, 2, 4, 6}, {n, 0, 11}]] (* _Alonso del Arte_, Sep 21 2011 *)

%t Select[Range[0, 150], MemberQ[{0, 1, 2, 4, 6}, Mod[#, 8]] &] (* _Vincenzo Librandi_, Mar 01 2016 *)

%t LinearRecurrence[{1,0,0,0,1,-1},{0,1,2,4,6,8},100] (* _Harvey P. Dale_, Aug 06 2018 *)

%o (PARI) a(n)=n\5*8 + [0, 1, 2, 4, 6][n%5+1] \\ _Charles R Greathouse IV_, Oct 27 2015

%o (Magma) [n : n in [0..140] | n mod 8 in [0, 1, 2, 4, 6] ]; // _Vincenzo Librandi_, Mar 01 2016

%o (GAP) Filtered([0..105],n->n mod 8 = 0 or n mod 8 = 1 or n mod 8 = 2 or n mod 8 = 4 or n mod 8 = 6); # _Muniru A Asiru_, Oct 23 2018

%K nonn,easy

%O 1,3

%A _N. J. A. Sloane_