This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A290132 #26 May 24 2023 07:33:41 %S A290132 1,6,24,74,170,362,642,1110,1766,2706,3894,5558,7602,10326,13562, %T A290132 17510,22178,28006,34634,42722,51922,62570,74450,88462,103994,121862, %U A290132 141482,163610,187886,215578,245430,279198,315958,356390,399830,447542,498626,555278,615698,681206 %N A290132 The number of edges in a graph induced by a regular drawing of K_{n,n}. %H A290132 Chai Wah Wu, <a href="/A290132/b290132.txt">Table of n, a(n) for n = 1..10000</a> %H A290132 M. Griffiths, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL13/Griffiths2/griffiths.html">Counting the regions in a regular drawing of K_{n,n}</a>, J. Int. Seq. 13 (2010) # 10.8.5, Table 2. %F A290132 a(n) = 2*n + A290131(n) + A159065(n) - 1. %p A290132 A290132 := proc(n) %p A290132 2*n+A290131(n)+A159065(n)-1 ; %p A290132 end proc: %p A290132 seq(A290132(n),n=1..40); %t A290132 b[n_] := Sum[(n-i+1)(n-j+1) Boole[GCD[i, j] == 1], {i, n}, {j, n}]; %t A290132 A290131[n_] := b[n-1] + (n-1)^2; %t A290132 A159065[n_] := Module[{x, y, s1 = 0, s2 = 0}, For[x = 1, x <= n - 1, x++, For[y = 1, y <= n - 1, y++, If[GCD[x, y] == 1, s1 += (n - x)(n - y); If[2x <= n - 1 && 2y <= n - 1, s2 += (n - 2x)(n - 2y)]]]]; s1 - s2]; %t A290132 a[n_] := 2n + A290131[n] + A159065[n] - 1; %t A290132 Table[a[n], {n, 1, 40}] (* _Jean-François Alcover_, May 24 2023, after _Joerg Arndt_ in A159065 *) %o A290132 (Python) %o A290132 from math import gcd %o A290132 def a115004(n): %o A290132 r=0 %o A290132 for a in range(1, n + 1): %o A290132 for b in range(1, n + 1): %o A290132 if gcd(a, b)==1:r+=(n + 1 - a)*(n + 1 - b) %o A290132 return r %o A290132 def a159065(n): %o A290132 c=0 %o A290132 for a in range(1, n): %o A290132 for b in range(1, n): %o A290132 if gcd(a, b)==1: %o A290132 c+=(n - a)*(n - b) %o A290132 if 2*a<n and 2*b<n:c-=(n - 2*a)*(n - 2*b) %o A290132 return c %o A290132 def a290131(n): return a115004(n - 1) + (n - 1)**2 %o A290132 def a(n): return 2*n + a290131(n) + a159065(n) - 1 %o A290132 print([a(n) for n in range(1, 51)]) # _Indranil Ghosh_, Jul 20 2017 %Y A290132 Cf. A159065, A290131. %K A290132 nonn,easy %O A290132 1,2 %A A290132 _R. J. Mathar_, Jul 20 2017