OFFSET
1,3
LINKS
Stefano Spezia, Table of n, a(n) for n = 1..10000
Mircea Merca and Emil Simion, n-Color Partitions into Distinct Parts as Sums over Partitions, Symmetry (2023) Vol. 15, Iss. 11.
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
G.f.: x^3*(x+2)/(1-x^2)^2.
a(n) = floor((n-1)/2) + (n is odd)*floor((n-1)/2).
a(n+2) = Sum_{k=0..n} (gcd(n, k) mod 2). - Paul Barry, May 02 2005
a(n) = Sum_{i=1..n-1} (-1)^i (floor(i/2) + ((i+1) mod 2)). - Olivier Gérard, Jun 21 2007
a(n) = A210530(n,4)/2 for n>2. - Boris Putievskiy, Jan 29 2013
a(n) = (3*n-4-n*(-1)^n)/4. - Boris Putievskiy, Jan 29 2013, corrected Jan 24 2022
a(n) = A026741(n)-1. - Wesley Ivan Hurt, Jun 23 2013
E.g.f.: 1 + (x - 1)*cosh(x) + (x - 2)*sinh(x)/2. - Stefano Spezia, Dec 17 2023
EXAMPLE
a(7) = 6 because we can write 7 = 1+6 = 2+5 = 3+4 = 4+3 = 5+2 = 6+1; a(8) = 3 because we can write 8 = 2+6 = 4+4 = 6+2.
MAPLE
A065423 := proc(n)
(3*n-4-(-1)^n*n)/4 ;
end proc:
seq(A065423(n), n=1..40) ; # R. J. Mathar, Jan 24 2022
MATHEMATICA
LinearRecurrence[{0, 2, 0, -1}, {0, 0, 2, 1}, 100] (* Harvey P. Dale, May 14 2014 *)
PROG
(PARI) a(n)=n-=2; if(n%2, n+1, n/2)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Len Smiley, Nov 23 2001
STATUS
approved