login
A140466
a(n) = 4*A002088(n).
1
0, 4, 8, 16, 24, 40, 48, 72, 88, 112, 128, 168, 184, 232, 256, 288, 320, 384, 408, 480, 512, 560, 600, 688, 720, 800, 848, 920, 968, 1080, 1112, 1232, 1296, 1376, 1440, 1536, 1584, 1728, 1800, 1896, 1960, 2120, 2168, 2336, 2416, 2512, 2600, 2784, 2848, 3016, 3096
OFFSET
0,2
COMMENTS
Number of distinct slopes in an n X n grid.
LINKS
Achim Flammenkamp, Cube 3
PROG
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
def A140466(n): # based on second formula in A018805
if n == 0:
return 0
c, j = 0, 2
k1 = n//j
while k1 > 1:
j2 = n//k1 + 1
c += (j2-j)*(A140466(k1)//2-1)
j, k1 = j2, n//j2
return 2*(n*(n-1)-c+j) # Chai Wah Wu, Mar 25 2021
CROSSREFS
Cf. A002088.
Sequence in context: A309141 A329882 A309181 * A343421 A337353 A368614
KEYWORD
nonn
AUTHOR
Ed Pegg Jr, Jun 29 2008
STATUS
approved