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.

Showing 1-6 of 6 results.

A334187 Number T(n,k) of k-element subsets of [n] avoiding 3-term arithmetic progressions; triangle T(n,k), n>=0, 0<=k<=A003002(n), read by rows.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 4, 6, 2, 1, 5, 10, 6, 1, 1, 6, 15, 14, 4, 1, 7, 21, 26, 10, 1, 8, 28, 44, 25, 1, 9, 36, 68, 51, 4, 1, 10, 45, 100, 98, 24, 1, 11, 55, 140, 165, 64, 7, 1, 12, 66, 190, 267, 144, 25, 1, 13, 78, 250, 407, 284, 78, 6, 1, 14, 91, 322, 601, 520, 188, 22, 1
Offset: 0

Views

Author

Alois P. Heinz, May 14 2020

Keywords

Comments

T(n,k) is defined for all n >= 0 and k >= 0. The triangle contains only elements with 0 <= k <= A003002(n). T(n,k) = 0 for k > A003002(n).

Examples

			Triangle T(n,k) begins:
  1;
  1,  1;
  1,  2,   1;
  1,  3,   3;
  1,  4,   6,   2;
  1,  5,  10,   6,    1;
  1,  6,  15,  14,    4;
  1,  7,  21,  26,   10;
  1,  8,  28,  44,   25;
  1,  9,  36,  68,   51,    4;
  1, 10,  45, 100,   98,   24;
  1, 11,  55, 140,  165,   64,   7;
  1, 12,  66, 190,  267,  144,  25;
  1, 13,  78, 250,  407,  284,  78,   6;
  1, 14,  91, 322,  601,  520, 188,  22,  1;
  1, 15, 105, 406,  849,  862, 386,  64,  4;
  1, 16, 120, 504, 1175, 1394, 763, 164, 14;
  ...
		

Crossrefs

Columns k=0-4 give: A000012, A000027, A000217(n-1), A212964(n-1), A300760.
Row sums give A051013.
Last elements of rows give A262347.

Programs

  • Maple
    b:= proc(n, s) option remember; `if`(n=0, 1, b(n-1, s)+ `if`(
          ormap(j-> 2*j-n in s, s), 0, expand(x*b(n-1, s union {n}))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, {})):
    seq(T(n), n=0..16);
  • Mathematica
    b[n_, s_] := b[n, s] = If[n == 0, 1, b[n-1, s] + If[AnyTrue[s, MemberQ[s, 2 # - n]&], 0, Expand[x b[n-1, s ~Union~ {n}]]]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][ b[n, {}]];
    T /@ Range[0, 16] // Flatten (* Jean-François Alcover, May 30 2020, after Maple *)

Formula

T(n,k) = Sum_{j=0..n} A334892(j,k).
T(n,A003002(n)) = A262347(n).

A140577 Decimal expansion of Wroblewski's constant arising in nonaveraging sequences.

Original entry on oeis.org

3, 0, 0, 8, 4, 9
Offset: 1

Views

Author

Jonathan Vos Post, Jul 05 2008

Keywords

Comments

A nonaveraging sequence contains no three terms which are in an arithmetic progression. Wroblewski (1984) showed that for infinite nonaveraging sequences Sup_{all nonaveraging sequences b(n)} Sum_{k>=1} 1/b(k) > 3.00849. [Typo corrected by Stefan Steinerberger, Aug 28 2008]

References

  • Steven R. Finch, "Erdos' Reciprocal Sum Constants." 2.20 in Mathematical Constants. Cambridge, England: Cambridge University Press, pp. 163-166, 2003.
  • R. K. Guy, "Nonaveraging Sets. Nondividing Sets." C16 in Unsolved Problems in Number Theory, 2nd ed. New York: Springer-Verlag, pp. 131-132, 1994.

Crossrefs

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

A018788 Number of subsets of {1,...,n} containing an arithmetic progression of length 3.

Original entry on oeis.org

0, 0, 0, 1, 3, 9, 24, 63, 150, 343, 746, 1605, 3391, 7075, 14624, 30076, 61385, 124758, 252618, 510161, 1027632, 2066304, 4148715, 8322113, 16680369, 33413592, 66904484, 133923906, 268009597, 536257466, 1072861536, 2146225299, 4293173040, 8587388627
Offset: 0

Views

Author

Keywords

Examples

			For n=4 the only subsets containing an arithmetic progression of length 3 are {1,2,3}, {2,3,4} and {1,2,3,4}.  Thus a(4) = 3. - _David Nacin_, Mar 03 2012
		

Crossrefs

Cf. A051013.

Programs

  • Mathematica
    a[n_] := a[n] = Count[Subsets[Range[n], {3, n}], {_, a_, _, b_, _, c_, _} /; b-a == c-b]; Table[Print[n, " ", a[n]]; a[n], {n, 0, 32}] (* Jean-François Alcover, May 30 2019 *)
  • Python
    # Prints out all such sets
    from itertools import combinations as comb
    def containsap3(n):
        ap3list=list()
        for skip in range(1,(n+1)//2):
            for start in range (1,n+1-2*skip):
                ap3list.append(set({start,start+skip,start+2*skip}))
        s=list()
        for i in range(3,n+1):
            for temptuple in comb(range(1,n+1),i):
                tempset=set(temptuple)
                for sub in ap3list:
                    if sub <= tempset:
                        s.append(tempset)
                        break
        return s #
    # Counts all such sets
    def a(n):
        return len(containsap3(n)) # David Nacin, Mar 03 2012

Formula

a(n) = 2^n - A051013(n). - David Nacin, Mar 03 2012

Extensions

a(33) from Alois P. Heinz, Jan 31 2014

A136299 a(n) = 3*a(n-1) - 4*a(n-3), with a(0)=1, a(1)=2, a(2)=4, a(3)=7.

Original entry on oeis.org

1, 2, 4, 7, 13, 23, 41, 71, 121, 199, 313, 455, 569, 455, -455, -3641, -12743, -36409, -94663, -233017, -553415, -1281593, -2912711, -6524473, -14447047, -31690297, -68972999, -149130809, -320631239, -686001721, -1461481927, -3101920825, -6561755591, -13839339065
Offset: 0

Views

Author

Paul Curtz, Mar 22 2008

Keywords

Crossrefs

Programs

  • Magma
    [1] cat [(2^(n-2)*(41-3*n) + (-1)^n)/9: n in [1..40]]; // G. C. Greubel, Apr 12 2021
    
  • Mathematica
    LinearRecurrence[{3,0,-4}, {1,2,4,7}, 41] (* G. C. Greubel, Apr 12 2021 *)
  • Sage
    [1]+[(2^(n-2)*(41-3*n) + (-1)^n)/9 for n in (1..40)] # G. C. Greubel, Apr 12 2021

Formula

From R. J. Mathar, Apr 04 2008: (Start)
O.g.f.: (1 -x -2*x^2 -x^3)/((1+x)*(1-2*x)^2).
a(n) = (11*2^n + (-1)^n)/9 - A001787(n+1)/12 if n>0. (End)
From G. C. Greubel, Apr 12 2021: (Start)
a(n) = (2^(n-2)*(41-3*n) + (-1)^n)/9 - (1/4)*[n=0].
E.g.f.: (-9 + 4*exp(-x) + (41 - 6*x)*exp(2*x))/36. (End)

A066369 Number of subsets of {1, ..., n} with no four terms in arithmetic progression.

Original entry on oeis.org

1, 2, 4, 8, 15, 29, 56, 103, 192, 364, 668, 1222, 2233, 3987, 7138, 12903, 22601, 40200, 71583, 125184, 218693, 386543, 670989, 1164385, 2021678, 3462265, 5930954, 10189081, 17266616, 29654738, 50912618, 86017601, 145327544, 247555043, 415598432, 698015188
Offset: 0

Views

Author

Jan Kristian Haugland, Dec 22 2001

Keywords

Examples

			a(5) = 29 because there are 32 subsets and three of them contain four terms in arithmetic progression: {1, 2, 3, 4}, {2, 3, 4, 5} and {1, 2, 3, 4, 5}.
		

Crossrefs

Programs

  • Python
    from sympy import subsets
    def noap4(n):
        avoid=list()
        for skip in range(1,(n+2)//3):
            for start in range (1,n+1-3*skip):
                avoid.append(set({start,start+skip,start+2*skip,start+3*skip}))
        s=list()
        for i in range(4):
            for smallset in subsets(range(1,n+1),i):
                s.append(smallset)
        for i in range(4,n+1):
            for temptuple in subsets(range(1,n+1),i):
                tempset=set(temptuple)
                status=True
                for avoidset in avoid:
                    if avoidset <= tempset:
                        status=False
                        break
                if status:
                    s.append(tempset)
        return s
    # Counts all such sets
    def a(n):
        return len(noap4(n)) # David Nacin, Mar 05 2012

Formula

a(n) = 2^n - A018789(n).

Extensions

a(31)-a(35) (using data in A018789) from Alois P. Heinz, Sep 08 2019
Showing 1-6 of 6 results.