OFFSET
0,3
COMMENTS
This sequence is G(n,8) where G(n,m) = sum(floor(k*n/m), k=1..m-1). This function is referenced in A109004 and is used in the following formula for gcd(n,m): gcd(n,m) = n+m-n*m+2*G(n,m).
Listed sequences of this form are:
G(n,2) ... A004526;
G(3,n) ... A130481;
G(n,4) ... A187326;
G(n,5) ... A187333;
G(n,6) ... A187336;
G(n,7) ... A187337;
G(n,k*n)/k = n*(n-1)/2 = G(n,n+k)-G(n,k).
It is of interest to note that this alternate form of gcd(n,m) will be undefined if m is a function having a zero in it. For example, gcd(n, n mod 4) would be undefined but gcd(n mod 4, n) would be defined.
FORMULA
a(n) = sum( floor(k*n/8), k=1..7 ).
a(n) = ( gcd(n,8) - (n+8) + n*8 )/2.
G.f.: x^2*(4 + 3*x + 5*x^2 + 2*x^3 + 4*x^4 + 3*x^5 + 7*x^6)/((1 + x)*(1 - x)^2*(1 + x^2)*(1 + x^4)). [Bruno Berselli, Jul 01 2014]
MAPLE
G:=(n, m)-> sum(floor(k*n/m), k=1..m-1): seq(G(n, 8), n = 0..60);
MATHEMATICA
Table[Sum[Floor[k n/8], {k, 1, 7}], {n, 0, 50}] (* Bruno Berselli, Jul 01 2014 *)
PROG
(Magma) [&+[Floor(k*n/8): k in [1..7]]: n in [0..50]]; // Bruno Berselli, Jul 01 2014
(Sage) [sum(floor(k*n/8) for k in (1..7)) for n in (0..50)] # Bruno Berselli, Jul 01 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Gary Detlefs, Jun 30 2014
EXTENSIONS
Some terms corrected by Bruno Berselli, Jul 01 2014
STATUS
approved