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.

A334044 a(1) = 0, and for any n > 1, a(n) is the number of points of the set { (k, a(k)), k = 1..n-2 } that are not visible from the point (n-1, a(n-1)).

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 1, 0, 4, 1, 1, 2, 2, 2, 3, 2, 3, 5, 2, 6, 4, 3, 3, 4, 4, 7, 1, 5, 5, 2, 6, 5, 4, 6, 6, 9, 0, 6, 9, 3, 4, 7, 5, 8, 5, 6, 6, 10, 8, 10, 7, 7, 7, 5, 6, 11, 6, 11, 8, 6, 14, 8, 8, 10, 11, 9, 8, 15, 8, 12, 8, 12, 11, 6, 14, 8, 12, 14, 10, 13, 8
Offset: 1

Views

Author

Rémy Sigrist, Apr 13 2020

Keywords

Comments

For any i and k such that i < k: the point (i, a(i)) is visible from the point (k, a(k)) if there are no j such that i < j < k and the three points (i, a(i)), (j, a(j)), (k, a(k)) are aligned.

Examples

			For n = 6:
- we consider the following points:
      .    .    .    X    .
                   (4,1)
      X    X    X    .    X
   (1,0) (2,0) (3,0)    (5,0)
- the points (1,0) and (2,0) are not visible from (5,0)
  (as they are hidden by (3,0)),
- whereas the points (3,0) and (4,1) are visible from (5,0)
- hence a(6) = 2.
		

Crossrefs

See A334043 for a similar sequence.

Programs

  • PARI
    g(z) = z/gcd(real(z), imag(z))
    for (n=1, #a=vector(81), print1 (a[n] = max(0, n-2) - #Set(apply(k -> g((k+a[k]*I)-(n-1+a[n-1]*I)), [1..n-2]))", "))