OFFSET
0,2
COMMENTS
Number of distinct slopes in an n X n grid.
LINKS
Al Zimmermann, Table of n, a(n) for n = 0..49999
Achim Flammenkamp, Cube 3
PROG
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
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
KEYWORD
nonn
AUTHOR
Ed Pegg Jr, Jun 29 2008
STATUS
approved