A047390 Numbers that are congruent to {0, 3, 5} mod 7.
0, 3, 5, 7, 10, 12, 14, 17, 19, 21, 24, 26, 28, 31, 33, 35, 38, 40, 42, 45, 47, 49, 52, 54, 56, 59, 61, 63, 66, 68, 70, 73, 75, 77, 80, 82, 84, 87, 89, 91, 94, 96, 98, 101, 103, 105, 108, 110, 112, 115, 117, 119, 122, 124, 126, 129, 131, 133, 136, 138, 140, 143
Offset: 1
Links
- Daniel Starodubtsev, Table of n, a(n) for n = 1..10000
- Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
Programs
-
Magma
[n: n in [0..122] | n mod 7 in [0, 3, 5]]; // Bruno Berselli, Mar 29 2011
-
Maple
seq(2*n+floor(n/3)+(n^2 mod 3), n=0..52); # Gary Detlefs, Mar 19 2010
-
Mathematica
Select[Range[0,150], MemberQ[{0,3,5}, Mod[#,7]]&] (* Harvey P. Dale, Dec 07 2011 *) CoefficientList[Series[x (3 + 2 x + 2 x^2)/((1 - x)^2 (1 + x + x^2)), {x, 0, 70}], x] (* Vincenzo Librandi, Nov 02 2014 *)
-
PARI
is(n)=!!setsearch([0,3,5],n%7) \\ Charles R Greathouse IV, Nov 09 2014
-
PARI
a(n)=(7*n-5)\3 \\ Charles R Greathouse IV, Nov 09 2014
-
Python
import math a = lambda n: 2*(n-1)+math.ceil((n-1)/3.0) for n in range(1,101): print(a(n), end = ", ") # Karl V. Keller, Jr., Nov 01 2014
Formula
a(n) = 2*n + floor(n/3) + (n^2 mod 3), with offset 0, a(0)=0. - Gary Detlefs, Mar 19 2010
From Bruno Berselli, Mar 29 2011: (Start)
G.f.: x^2*(3 + 2*x + 2*x^2)/((1 - x)^2*(1 + x + x^2)).
a(n) = n + ceiling(4*(n-1)/3) - 1. - Arkadiusz Wesolowski, Sep 18 2012
a(n) = 2*(n-1) + ceiling((n-1)/3). - Karl V. Keller, Jr., Nov 01 2014
From Wesley Ivan Hurt, Jun 10 2016: (Start)
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
a(n) = 7*n/3 - 2 - 2*sin(2*n*Pi/3)/(3*sqrt(3)).
a(3*k) = 7*k-2, a(3*k-1) = 7*k-4, a(3*k-2) = 7*k-7. (End)
Comments