Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #21 Sep 17 2024 08:24:33
%S 1,2,1,2,2,2,3,4,3,4,4,4,5,6,5,6,6,6,7,8,7,8,8,8,9,10,9,10,10,10,11,
%T 12,11,12,12,12,13,14,13,14,14,14,15,16,15,16,16,16,17,18,17,18,18,18,
%U 19,20,19,20,20,20,21,22,21,22,22,22,23,24,23,24,24,24,25,26,25,26,26,26
%N Number of numbers congruent to 2 or 4 mod 6 between n and 2n inclusive.
%H G. C. Greubel, <a href="/A123920/b123920.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,0,0,1,-1).
%F a(n) = 2k - 1 for n = {6k - 5, 6k - 3}, where k = 1,2,3,... a(n) = 2k for n = {6k - 4, 6k - 2, 6k - 1, 6k}, where k = 1,2,3,... - _Alexander Adamchuk_, Nov 08 2006
%F G.f.: x*(1+x-x^2+x^3)/((1-x)*(1-x^6)). - _G. C. Greubel_, Aug 07 2019
%p seq(coeff(series(x*(1+x-x^2+x^3)/((1-x)*(1-x^6)), x, n+1), x, n), n = 1..80); # _G. C. Greubel_, Aug 07 2019
%t f[n_]:= Floor[n/2] - Floor[n/6]; Table[f[2n] - f[n-1], {n, 80}] (* _Robert G. Wilson v_ *)
%t Table[Count[Range[n,2n],_?(MemberQ[{2,4},Mod[#,6]]&)],{n,80}] (* _Harvey P. Dale_, Mar 25 2019 *)
%t LinearRecurrence[{1,0,0,0,0,1,-1}, {1,2,1,2,2,2,3}, 80] (* _G. C. Greubel_, Aug 07 2019 *)
%o (PARI) my(x='x+O('x^80)); Vec(x*(1+x-x^2+x^3)/((1-x)*(1-x^6))) \\ _G. C. Greubel_, Aug 07 2019
%o (Magma) R<x>:=PowerSeriesRing(Integers(), 80); Coefficients(R!( x*(1+x-x^2+x^3)/((1-x)*(1-x^6)) )); // _G. C. Greubel_, Aug 07 2019
%o (Sage)
%o def A123920_list(prec):
%o P.<x> = PowerSeriesRing(ZZ, prec)
%o return P( x*(1+x-x^2+x^3)/((1-x)*(1-x^6)) ).list()
%o a=A123920_list(80); a[1:] # _G. C. Greubel_, Aug 07 2019
%o (GAP) a:=[1,2,1,2,2,2,3];; for n in [8..80] do a[n]:=a[n-1]+a[n-6]-a[n-7]; od; a; # _G. C. Greubel_, Aug 07 2019
%Y Cf. A123919.
%K nonn,easy
%O 1,2
%A _Giovanni Teofilatto_, Oct 29 2006
%E Corrected and extended by _Robert G. Wilson v_, Oct 29 2006
%E More terms from _Alexander Adamchuk_, Nov 08 2006