OFFSET
1,1
COMMENTS
In other words, numbers that are divisible by 2 or by 3, but not by 6 (sorted). - David James Sycamore, Aug 22 2023
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
From Paul Barry, Sep 01 2009: (Start)
G.f.: (2+x+x^2+2*x^3)/(1-x-x^3+x^4).
a(n) = 2*n-1-cos(2*n*Pi/3)+sin(2*n*Pi/3)/sqrt(3). (End) [adapted for offset 1 by Wesley Ivan Hurt, Jun 13 2016]
From Wesley Ivan Hurt, Jun 13 2016: (Start)
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
a(3k) = 6k-2, a(3k-1) = 6k-3, a(3k-2) = 6k-4. (End)
Sum_{n>=1} (-1)^(n+1)/a(n) = (4*sqrt(3)-3)*Pi/36. - Amiram Eldar, Dec 16 2021
E.g.f.: 2 + exp(x)*(2*x - 1) - exp(-x/2)*(3*cos(sqrt(3)*x/2) - sqrt(3)*sin(sqrt(3)*x/2))/3. - Stefano Spezia, Jul 26 2024
EXAMPLE
From David A. Corneth, Aug 22 2023: (Start)
10 is in the sequence as 10 == 4 (mod 6) and 4 is in {2, 3, 4}.
11 is not in the sequence as 11 == 5 (mod 6) and 5 is not in {2, 3, 4}. (End)
MAPLE
A047228:=n->2*n-1-cos(2*n*Pi/3)+sin(2*n*Pi/3)/sqrt(3): seq(A047228(n), n=1..100); # Wesley Ivan Hurt, Jun 13 2016
MATHEMATICA
Select[Range[0, 150], MemberQ[{2, 3, 4}, Mod[#, 6]]&] (* Vincenzo Librandi, Jan 06 2013 *)
PROG
(Magma) [n: n in [0..120] | n mod 6 in [2..4]]; // Vincenzo Librandi, Jan 05 2013
(Haskell)
a047228 n = a047228_list !! (n-1)
a047228_list = 2 : 3 : 4 : map (+ 6) a047228_list
-- Reinhard Zumkeller, Feb 19 2013
(PARI) a(n) = 6*((n-1)\3) + 2 + (n-1)%3 \\ David A. Corneth, Aug 22 2023
(PARI) nxt(n) = if(n%3 == 1, n+4, n+1) \\ David A. Corneth, Aug 22 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved