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.

A334893 Number of subsets of [n] avoiding 3-term arithmetic progressions and containing n if n>0.

Original entry on oeis.org

1, 1, 2, 3, 6, 10, 17, 25, 41, 63, 109, 165, 262, 412, 643, 932, 1459, 2163, 3212, 4601, 6817, 9904, 14741, 20906, 30352, 43993, 63540, 89442, 132037, 187587, 266842, 378061, 535907, 751709, 1077809, 1499972, 2084027, 2951390, 4114165, 5651914, 7968177
Offset: 0

Views

Author

Alois P. Heinz, May 14 2020

Keywords

Crossrefs

Row sums of A334892.
Partial sums give A051013.

Programs

  • Maple
    b:= proc(n, s) option remember; `if`(n<1, 1, b(n-1, s)+
         `if`(ormap(j-> 2*j-n in s, s), 0, b(n-1, s union {n})))
        end:
    a:= n-> b(n-1, {n}):
    seq(a(n), n=0..23);
  • Mathematica
    b[n_, s_] := b[n, s] = If[n < 1, 1, b[n-1, s] +
         If[AnyTrue[s, MemberQ[s, 2 # - n]&], 0, b[n-1, s ~Union~ {n}]]];
    a[n_] := b[n-1, {n}];
    a /@ Range[0, 23] (* Jean-François Alcover, May 03 2021, after Alois P. Heinz *)