A047228 Numbers that are congruent to {2, 3, 4} mod 6.
2, 3, 4, 8, 9, 10, 14, 15, 16, 20, 21, 22, 26, 27, 28, 32, 33, 34, 38, 39, 40, 44, 45, 46, 50, 51, 52, 56, 57, 58, 62, 63, 64, 68, 69, 70, 74, 75, 76, 80, 81, 82, 86, 87, 88, 92, 93, 94, 98, 99, 100, 104, 105, 106, 110, 111, 112, 116, 117, 118, 122, 123, 124
Offset: 1
Examples
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)
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).
Programs
-
Haskell
a047228 n = a047228_list !! (n-1) a047228_list = 2 : 3 : 4 : map (+ 6) a047228_list -- Reinhard Zumkeller, Feb 19 2013
-
Magma
[n: n in [0..120] | n mod 6 in [2..4]]; // Vincenzo Librandi, Jan 05 2013
-
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 *)
-
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
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
Comments