OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,-1,0,1,-2,1).
FORMULA
a(n) = n + floor((n^2 - 1)/8).
a(n) = n + ceiling(n^2/8) - 1. - Wesley Ivan Hurt, Jun 28 2013
From Bruno Berselli, Jul 05 2013: (Start)
G.f.: x*(1 + x^2 - x^3 + x^4 - x^5)/((1+x)*(1+x^2)*(1-x)^3).
a(n) = (2*n*(n+8) - (1+(-1)^n)*(5+2*i^(n*(n+1))) - 2)/16 where i=sqrt(-1). (End)
E.g.f.: (8 - 2*cos(x) + (x^2 + 9*x - 6)*cosh(x) + (x^2 + 9*x - 1)*sinh(x))/8. - Stefano Spezia, Apr 06 2024
EXAMPLE
First, write
.....8...16..24..32..40..48..56..64..72..80.. (8i)
1..4..9..16...25...36.....49.....64.......81. (squares)
Then replace each number by its rank, where ties are settled by ranking 8i after the square:
p = (3,6,7,9,11,12,14,16,17,...) = A186348 = n + floor(sqrt(8n+1/2)).
q = (1,2,4,5,8,10,13,15,19,...) = a(n).
MAPLE
seq(k+ceil(k^2/8)-1, k=1..100); # Wesley Ivan Hurt, Jun 28 2013
MATHEMATICA
(* adjusted joint rank sequences p and q (=a(n)), using general formula for ranking 1st degree u*n+v and 2nd degree x*n^2 + y*n + z *)
d=-1/2; u=8; v=0; x=1; y=0;
k[n_]:=(x*n^2+y*n-v+d)/u;
a[n_]:=n+Floor[k[n]];
Table[a[n], {n, 1, 100}]
PROG
(Magma) m:=90; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!((1+x^2-x^3+x^4-x^5)/((1+x)*(1+x^2)*(1-x)^3))); // Bruno Berselli, Jul 05 2013
(PARI) a(n)=(n^2-1)\8+n \\ Charles R Greathouse IV, Jul 05 2013
(Maxima) makelist((2*n*(n+8)-(1+(-1)^n)*(5+2*%i^(n*(n+1)))-2)/16, n, 1, 90); /* Bruno Berselli, Jul 05 2013 */
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Feb 20 2011
STATUS
approved