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

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

%S 1,2,4,5,7,9,10,12,13,15,17,18,20,21,23,25,26,28,29,31,33,34,36,37,39,

%T 41,42,44,45,47,49,50,52,53,55,57,58,60,61,63,65,66,68,69,71,73,74,76,

%U 77,79,81,82,84,85,87,89,90,92,93,95,97,98,100,101,103

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

%H Vincenzo Librandi, <a href="/A047497/b047497.txt">Table of n, a(n) for n = 1..5000</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 a(n) = floor((8n-3)/5). [_Gary Detlefs_, Mar 07 2010]

%F From _R. J. Mathar_, Mar 23 2010: (Start)

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

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

%p seq(floor((8*n-3)/5),n=1..56); # _Gary Detlefs_, Mar 07 2010

%t Select[Range[120],MemberQ[{1,2,4,5,7},Mod[#,8]]&] (* or *) LinearRecurrence[ {1,0,0,0,1,-1},{1,2,4,5,7,9},100] (* _Harvey P. Dale_, Jun 05 2017 *)

%t Table[8 n + {1, 2, 4, 5, 7}, {n, 0, 20}]//Flatten (* _Vincenzo Librandi_, Jun 06 2017 *)

%o (PARI) for (n=1, 80, print1((8*n-3)\5, ", ")) \\ _Michel Marcus_, Sep 10 2014

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

%Y Cf. A047399 (complement).

%K nonn,easy

%O 1,2

%A _N. J. A. Sloane_