cp's OEIS Frontend

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.

A140466 a(n) = 4*A002088(n).

Original entry on oeis.org

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

Views

Author

Ed Pegg Jr, Jun 29 2008

Keywords

Comments

Number of distinct slopes in an n X n grid.

Crossrefs

Cf. A002088.

Programs

  • 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