login
A030118
a(0) = 1, a(1) = 1, a(n) = a(n-1) - a(n-2) + n.
2
1, 1, 2, 4, 6, 7, 7, 7, 8, 10, 12, 13, 13, 13, 14, 16, 18, 19, 19, 19, 20, 22, 24, 25, 25, 25, 26, 28, 30, 31, 31, 31, 32, 34, 36, 37, 37, 37, 38, 40, 42, 43, 43, 43, 44, 46, 48, 49, 49, 49, 50, 52, 54, 55, 55, 55, 56, 58, 60, 61, 61, 61, 62, 64, 66, 67, 67, 67, 68, 70, 72, 73
OFFSET
0,3
COMMENTS
Contains all positive integers except for 3 mod 6 and 5 mod 6 (A047270). - Jon Perry, Nov 02 2014
FORMULA
a(
G.f.: (1-2*x+3*x^2-x^3)/((1-x+x^2)*(1-x)^2). - Robert Israel, Nov 02 2014
a(n) = n iff n is either 1 or 2 mod 6. - Jon Perry, Nov 02 2014
a(n) = n + 1 - ((-1)^floor((n-1)/3) + (-1)^floor(n/3))/2) = n + 1 - A010892(n+5). - G. C. Greubel, Jul 24 2019
For k >= 1, a(6*k-1) = a(6*k) = a(6*k+1) = 6*k+1; a(6*k+2) = 6*k+2; a(6*k+3) = 6*k+4; a(6*k+4) = 6*k+6. - Bernard Schott, Jul 24 2019
a(n) = 3*a(n-1) - 4*a(n-2) + 3*a(n-3) - a(n-4) for n > 3. - Chai Wah Wu, Jun 30 2020
MAPLE
A:= gfun:-rectoproc({a(n)=a(n-1)-a(n-2)+n , a(0)=1, a(1)=1}, a(n), remember):
seq(A(n), n=0..80); # Robert Israel, Nov 02 2014
MATHEMATICA
Table[n+1 -((-1)^Floor[(n-1)/3] +(-1)^Floor[n/3])/2, {n, 0, 80}] (* G. C. Greubel, Jul 24 2019 *)
PROG
(Sage) [lucas_number1(n+1, 2, 1)-lucas_number1(n, 1, 1) for n in range(0, 80)] # Zerinvary Lajos, Nov 10 2009
(Magma) [1] cat [n le 2 select (n) else n + Self(n-1)-Self(n-2): n in [1..80]]; // Vincenzo Librandi, Nov 02 2014
(PARI) vector(80, n, n--; n+1 - ((-1)^floor((n-1)/3) + (-1)^floor(n/3))/2) \\ G. C. Greubel, Jul 24 2019
(GAP) Concatenation([1], List([1..80], n-> n+1 - ((-1)^Int((n-1)/3) + (-1)^Int(n/3))/2 )); # G. C. Greubel, Jul 24 2019
CROSSREFS
Sequence in context: A167689 A058184 A087777 * A331379 A023835 A272633
KEYWORD
nonn,easy
EXTENSIONS
More terms from Erich Friedman
STATUS
approved