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).

This page as a plain text file.
%I A140466 #15 Mar 26 2021 08:42:19
%S A140466 0,4,8,16,24,40,48,72,88,112,128,168,184,232,256,288,320,384,408,480,
%T A140466 512,560,600,688,720,800,848,920,968,1080,1112,1232,1296,1376,1440,
%U A140466 1536,1584,1728,1800,1896,1960,2120,2168,2336,2416,2512,2600,2784,2848,3016,3096
%N A140466 a(n) = 4*A002088(n).
%C A140466 Number of distinct slopes in an n X n grid.
%H A140466 Al Zimmermann, <a href="/A140466/b140466.txt">Table of n, a(n) for n = 0..49999</a>
%H A140466 Achim Flammenkamp, <a href="http://www.math.uni-bielefeld.de/~sillke/PUZZLES/cube3">Cube 3</a>
%o A140466 (Python)
%o A140466 from functools import lru_cache
%o A140466 @lru_cache(maxsize=None)
%o A140466 def A140466(n): # based on second formula in A018805
%o A140466     if n == 0:
%o A140466         return 0
%o A140466     c, j = 0, 2
%o A140466     k1 = n//j
%o A140466     while k1 > 1:
%o A140466         j2 = n//k1 + 1
%o A140466         c += (j2-j)*(A140466(k1)//2-1)
%o A140466         j, k1 = j2, n//j2
%o A140466     return 2*(n*(n-1)-c+j) # _Chai Wah Wu_, Mar 25 2021
%Y A140466 Cf. A002088.
%K A140466 nonn
%O A140466 0,2
%A A140466 _Ed Pegg Jr_, Jun 29 2008