|
|
A331771
|
|
a(n) = Sum_{-n<i<n, -n<j<n, gcd{i,j}=1} (n-|i|)*(n-|j|).
|
|
4
|
|
|
0, 12, 56, 172, 400, 836, 1496, 2564, 4080, 6212, 8984, 12788, 17488, 23644, 31112, 40148, 50912, 64172, 79448, 97868, 118912, 143108, 170504, 202500, 238080, 278700, 323864, 374508, 430272, 493380, 561832, 638692, 722656, 814604, 914360, 1023428
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
a(n) = 8*A332612(n)+4*n*(n-1)+4*(n-1)^2. Also adding 2 to the terms of the present sequence gives (essentially) A114146. - N. J. A. Sloane, Mar 14 2020
|
|
REFERENCES
|
Koplowitz, Jack, Michael Lindenbaum, and A. Bruckstein. "The number of digital straight lines on an N* N grid." IEEE Transactions on Information Theory 36.1 (1990): 192-197. (See I(n).)
|
|
LINKS
|
|
|
FORMULA
|
a(n) = 4*((n-1)*(2n-1)+Sum_{i=2..n-1} (n-i)*(2*n-i)*phi(i)). - Chai Wah Wu, Aug 17 2021
|
|
MAPLE
|
VR := proc(m, n, q) local a, i, j; a:=0;
for i from -m+1 to m-1 do for j from -n+1 to n-1 do
if gcd(i, j)=q then a:=a+(m-abs(i))*(n-abs(j)); fi; od: od: a; end;
[seq(VR(n, n, 1), n=1..50)];
|
|
MATHEMATICA
|
a[n_] := Sum[Boole[GCD[i, j] == 1] (n - Abs[i]) (n - Abs[j]), {i, -n + 1, n - 1}, {j, -n + 1, n - 1}];
|
|
PROG
|
(Python)
from sympy import totient
def A331771(n): return 4*((n-1)*(2*n-1)+sum(totient(i)*(n-i)*(2*n-i) for i in range(2, n))) # Chai Wah Wu, Aug 17 2021
|
|
CROSSREFS
|
When divided by 4 this becomes A115005, so this is a ninth sequence to add to the following list.
The following eight sequences are all essentially the same. The simplest is A115004(n), which we denote by z(n). Then A088658(n) = 4*z(n-1); A114043(n) = 2*z(n-1)+2*n^2-2*n+1; A114146(n) = 2*A114043(n); A115005(n) = z(n-1)+n*(n-1); A141255(n) = 2*z(n-1)+2*n*(n-1); A290131(n) = z(n-1)+(n-1)^2; A306302(n) = z(n)+n^2+2*n.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|