OFFSET
0,3
COMMENTS
It is also the number of 2 X 2 integer matrices with elements from {1,...,n} whose determinant is -1.
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..1000
FORMULA
From Andrew Howroyd, May 05 2020: (Start)
a(n) = A171503(n) - (2*n + 1) for n > 0.
a(n) = -2*(n + 1) + 4*Sum_{k=1..n} phi(k) for n > 0.
a(n) = 2 * A209978(n). (End)
MAPLE
a:= proc(n) option remember; `if`(n<2, 0,
a(n-1)-2 + 4*numtheory[phi](n))
end:
seq(a(n), n=0..60); # Alois P. Heinz, May 05 2020
MATHEMATICA
Table[cnt = 0; Do[If[a*d-b*c == 1, cnt++], {a, n}, {b, n}, {c, n}, {d, n}]; cnt, {n, 50}] (* T. D. Noe, Oct 11 2011 *)
PROG
(PARI) a(n) = if(n < 1, 0, 4*sum(k=1, n, eulerphi(k)) - 2*(n + 1)) \\ Andrew Howroyd, May 05 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Aldo González Lorenzo, Sep 29 2011
EXTENSIONS
a(0)=0 prependend by Andrew Howroyd, May 05 2020
STATUS
approved