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.

A212964 Number of (w,x,y) with all terms in {0,...,n} and |w-x| < |x-y| < |y-w|.

Original entry on oeis.org

0, 0, 0, 2, 6, 14, 26, 44, 68, 100, 140, 190, 250, 322, 406, 504, 616, 744, 888, 1050, 1230, 1430, 1650, 1892, 2156, 2444, 2756, 3094, 3458, 3850, 4270, 4720, 5200, 5712, 6256, 6834, 7446, 8094, 8778, 9500, 10260, 11060, 11900, 12782, 13706
Offset: 0

Views

Author

Clark Kimberling, Jun 02 2012

Keywords

Comments

For a guide to related sequences, see A212959.
Magic numbers of nucleons in a biaxially deformed nucleus at oscillator ratio 1:2 (oblate ellipsoid) under the simple harmonic oscillator model. - Jess Tauber, May 14 2013
a(n) is the number of Sidon subsets of {1,...,n+1} of size 3. - Carl Najafi, Apr 27 2014

Crossrefs

First differences: A007590, is first differences of 2*A001752(n-4) for n > 3; partial sums: 2*A001752(n-3) for n > 2, is partial sums of A007590(n-1) for n > 0. - Guenther Schrack, Mar 19 2018

Programs

  • Magma
    [(2*n-1)*(2*n^2-2*n-3)/24 - (-1)^n/8: n in [0..50]]; // Vincenzo Librandi, Jul 25 2014
    
  • Maple
    A212964:=n->add(floor(i^2/2) - 2*floor(i/2), i=1..n): seq(A212964(n), n=0..50); # Wesley Ivan Hurt, Jul 23 2014
  • Mathematica
    t = Compile[{{n, _Integer}}, Module[{s = 0},
    (Do[If[Abs[w - x] < Abs[x - y] < Abs[y - w], s = s + 1],
    {w, 0, n}, {x, 0, n}, {y, 0, n}]; s)]];
    m = Map[t[#] &, Range[0, 45]]   (* A212964 *)
    m/2 (* essentially A002623 *)
    CoefficientList[Series[2 x^3/((1 + x) (1 - x)^4), {x, 0, 50}], x] (* Vincenzo Librandi, Jul 25 2014 *)
  • PARI
    a(n) = (2*n-1)*(2*n^2-2*n-3)/24 - (-1)^n/8;
    vector (100, n, a(n-1)) \\ Altug Alkan, Sep 30 2015

Formula

a(n) = 3*a(n-1)-2*a(n-2)-2*a(n-3)+3*a(n-4)-a(n-5).
G.f.: f(x)/g(x), where f(x)=2*x^3 and g(x)=(1+x)(1-x)^4.
a(n+3) = 2*A002623(n).
a(n) = Sum_{k=0..n} floor((k-1)^2/2). - Enrique Pérez Herrero, Dec 28 2013
a(n) = Sum_{i=1..n} floor(i^2/2) - 2*floor(i/2). - Wesley Ivan Hurt, Jul 23 2014
a(n) = (2*n-1)*(2*n^2-2*n-3)/24 - (-1)^n/8. - Robert Israel, Jul 23 2014
E.g.f.: (x*(2*x^2 + 3*x - 3)*cosh(x) + (2*x^3 + 3*x^2 - 3*x + 3)*sinh(x))/12. - Stefano Spezia, Jul 06 2021

A051013 Number of nonaveraging subsets on {1,2,...,n}.

Original entry on oeis.org

1, 2, 4, 7, 13, 23, 40, 65, 106, 169, 278, 443, 705, 1117, 1760, 2692, 4151, 6314, 9526, 14127, 20944, 30848, 45589, 66495, 96847, 140840, 204380, 293822, 425859, 613446, 880288, 1258349, 1794256, 2545965, 3623774, 5123746, 7207773, 10159163, 14273328, 19925242, 27893419
Offset: 0

Views

Author

Keywords

Examples

			The only subset of s = {1,2,3} that contains a 3-term arithmetic progression is s itself, so a(3) = 7.
		

Crossrefs

Cf. A018788.
Row sums of A334187.
First differences give A334893.

Programs

  • Mathematica
    a[n_] := a[n] = 2^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
    def nonaveragingsets(n):
        avoid=list()
        for skip in range(1,(n+1)//2):
            for start in range (1,n+1-2*skip):
                avoid.append(set({start,start+skip,start+2*skip}))
        s=list()
        for i in range(3):
            for smallset in comb(range(1,n+1),i):
                s.append(smallset)
        for i in range(3,n+1):
            for temptuple in comb(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(nonaveragingsets(n)) # David Nacin, Mar 03 2012

Formula

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

Extensions

More terms from John W. Layman, Nov 27 2001
a(29)-a(37) from Donovan Johnson, Aug 15 2010
a(38)-a(40) from Alois P. Heinz, Oct 27 2011

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

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 2, 0, 1, 3, 2, 0, 1, 4, 4, 1, 0, 1, 5, 8, 3, 0, 1, 6, 12, 6, 0, 1, 7, 18, 15, 0, 1, 8, 24, 26, 4, 0, 1, 9, 32, 47, 20, 0, 1, 10, 40, 67, 40, 7, 0, 1, 11, 50, 102, 80, 18, 0, 1, 12, 60, 140, 140, 53, 6, 0, 1, 13, 72, 194, 236, 110, 16, 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

			  1;
  0, 1;
  0, 1,  1;
  0, 1,  2;
  0, 1,  3,  2;
  0, 1,  4,  4,   1;
  0, 1,  5,  8,   3;
  0, 1,  6, 12,   6;
  0, 1,  7, 18,  15;
  0, 1,  8, 24,  26,   4;
  0, 1,  9, 32,  47,  20;
  0, 1, 10, 40,  67,  40,   7;
  0, 1, 11, 50, 102,  80,  18;
  0, 1, 12, 60, 140, 140,  53,   6;
  0, 1, 13, 72, 194, 236, 110,  16,  1;
  0, 1, 14, 84, 248, 342, 198,  42,  3;
  0, 1, 15, 98, 326, 532, 377, 100, 10;
  ...
		

Crossrefs

Columns k=0-3 give: A000007, A057427, A000027(n-1), A007590(n-2).
Row sums give A334893.
Last elements of rows give A334894.

Programs

  • Maple
    b:= proc(n, s) option remember; `if`(n=0, x, 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)))(
                `if`(n=0, 1, b(n-1, {n}))):
    seq(T(n), n=0..16);
  • Mathematica
    b[n_, s_] := b[n, s] = If[n == 0, x, b[n-1, s] + If[
         AnyTrue[s, MemberQ[s, 2#-n]&], 0, Expand[x*b[n-1, s ~Union~ {n}]]]];
    T[n_] := If[n == 0, {1}, CoefficientList[b[n-1, {n}], x]];
    T /@ Range[0, 16] // Flatten (* Jean-François Alcover, May 03 2021, after Alois P. Heinz *)

Formula

T(0,k) = A334187(0,k), T(n,k) = A334187(n,k) - A334187(n-1,k) for n > 0.

A262347 Number of subsets of [1..n] of maximal size that are free of 3-term arithmetic progressions.

Original entry on oeis.org

1, 1, 1, 3, 2, 1, 4, 10, 25, 4, 24, 7, 25, 6, 1, 4, 14, 43, 97, 220, 2, 18, 62, 232, 2, 33, 2, 12, 36, 106, 1, 11, 2, 4, 14, 40, 2, 4, 86, 307, 20, 1, 4, 14, 41, 99, 266, 674, 1505, 3510, 7726, 14, 50, 156, 2, 8, 26, 56, 2, 4, 6, 14, 48, 2, 4, 8, 16, 28, 108, 319, 1046, 4, 26, 82, 1, 2
Offset: 0

Views

Author

Nathan McNew, Sep 18 2015

Keywords

Comments

The sequence A003002 gives the size of the largest subset of the integers up to n that avoids three-term arithmetic progressions. This sequence gives the number of distinct subsets of [1..n] that have that size and are free of three-term arithmetic progressions.

Examples

			The largest subset of [1,6] that doesn't have any 3 terms in arithmetic progression has size 4. There are 4 such subsets with this property: {1,2,4,5}, {1,2,5,6}, {1,3,4,6} and {2,3,5,6}, so a(6)=4.
		

Crossrefs

Last elements of rows of A334187.

Programs

  • Maple
    G:= proc(n, cons, t)
    option remember;
    local consn, consr;
       if n < t or member({},cons) then return {} fi;
       if t = 0 then return {{}} fi;
       consn, consr:= selectremove(has,cons,n);
       consn:= subs(n=NULL,consn);
       procname(n-1,consr,t) union
          map(`union`,procname(n-1,consr union   consn,t-1),{n});
    end proc:
    F:= proc(n)
    local m,cons,R;
       m:= A003002(n-1);
       cons:= {seq(seq({i,i+j,i+2*j},i=1..n-2*j),j=1..(n-1)/2)};
       R:= G(n,cons,m+1);
       if R = {} then
          A003002(n):= m;
          G(n,cons,m);
       else
          A003002(n):= m+1;
          R
       fi
    end proc:
    A003002(1):= 1:
    a[1]:= 1:
    for n from 2 to 40 do
      a[n]:= nops(F(n))
    od:
    seq(a[i],i=1..40); # Robert Israel, Sep 20 2015
  • Mathematica
    A003002 = Cases[Import["https://oeis.org/A003002/b003002.txt", "Table"], {, }][[All, 2]];
    a[n_] := a[n] = Count[Subsets[Range[n], {A003002[[n+1]]}], s_ /; !MatchQ[s, {_, n1_, _, n2_, _, n3_, _} /; n2 - n1 == n3 - n2]];
    Table[Print[n, " ", a[n]]; a[n], {n, 0, 25}] (* Jean-François Alcover, May 30 2020 *)

Extensions

a(25) to a(44) from Robert Israel, Sep 20 2015
a(45) to a(75) from Fausto A. C. Cariboni, Jan 15 2018
a(0)=1 prepended by Alois P. Heinz, May 16 2020

A300760 Number of ways to select 4 numbers from the set of the first n natural numbers avoiding 3-term arithmetic progressions.

Original entry on oeis.org

0, 1, 4, 10, 25, 51, 98, 165, 267, 407, 601, 849, 1175, 1580, 2089, 2703, 3452, 4338, 5395, 6622, 8058, 9706, 11606, 13758, 16210, 18963, 22066, 25520, 29379, 33645, 38376, 43571, 49293, 55545, 62391, 69831, 77937, 86710, 96223, 106477, 117550, 129444, 142241
Offset: 4

Views

Author

Heinrich Ludwig, Mar 12 2018

Keywords

Examples

			There are 4 selections of 4 natural numbers from the set {1,2,3,4,5,6} free of 3-term arithmetic progressions: {1,2,4,5}, {1,2,5,6}, {1,3,4,6}, {2,3,5,6}.
		

Crossrefs

Column k=4 of A334187.

Programs

  • Mathematica
    Array[(#^4 - 12 #^3 + 51 #^2 - 78 # + 32)/24 + Boole[OddQ@ #] (-# + 2)/4 - Boole[Mod[#, 3] == 0]/3 - Boole[Mod[#, 4] == 0] &, 43, 4] (* Michael De Vlieger, Mar 14 2018 *)
    LinearRecurrence[{2,0,-1,0,-2,2,0,1,0,-2,1},{0,1,4,10,25,51,98,165,267,407,601},50] (* Harvey P. Dale, Feb 18 2024 *)
  • PARI
    concat(0, Vec(x^5*(1 + 2*x + 2*x^2 + 6*x^3 + 5*x^4 + 8*x^5) / ((1 - x)^5*(1 + x)^2*(1 + x^2)*(1 + x + x^2)) + O(x^60))) \\ Colin Barker, Aug 06 2018

Formula

a(n) = (n^4 - 12*n^3 + 51*n^2 - 78*n + 32)/24 + b(n) + c(n), where
b(n) = 0 for n even
b(n) = (-n + 2)/4 for n odd
c(n) = 0 for n == 1,2,5,7,10,11 (mod 12)
c(n) = -1/3 for n == 3,6,9 (mod 12)
c(n) = -4/3 for n == 0 (mod 12)
c(n) = -1 for n == 4,8 (mod 12).
a(n) = (n^4 - 12*n^3 + 51*n^2 - 78*n + 32)/24 + (n == 1 (mod 2))*(-n + 2)/4 - (n == 0 (mod 3))/3 - (n == 0 (mod 4)).
From Colin Barker, Mar 12 2018: (Start)
G.f.: x^5*(1 + 2*x + 2*x^2 + 6*x^3 + 5*x^4 + 8*x^5) / ((1 - x)^5*(1 + x)^2*(1 + x^2)*(1 + x + x^2)).
a(n) = 2*a(n-1) - a(n-3) - 2*a(n-5) + 2*a(n-6) + a(n-8) - 2*a(n-10) + a(n-11) for n>14.
(End)

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

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 3, 6, 15, 4, 20, 7, 18, 6, 1, 3, 10, 29, 54, 123, 2, 16, 44, 170, 2, 31, 2, 10, 24, 70, 1, 10, 2, 2, 10, 26, 2, 2, 82, 221, 20, 1, 3, 10, 27, 58, 167, 408, 831, 2005, 4216, 14, 36, 106, 2, 6, 18, 30, 2, 2, 2, 8, 34, 2, 2, 4, 8, 12, 80, 211
Offset: 0

Views

Author

Alois P. Heinz, May 14 2020

Keywords

Crossrefs

Last elements of rows of A334892.

Formula

a(n) = A262347(n) - [n > 0 and A003002(n) = A003002(n-1)] * A262347(n-1).
a(n) = A334892(n,A003002(n)).
a(n) = A334187(n,A003002(n)) - [n > 0] * A334187(n-1,A003002(n)).
Showing 1-6 of 6 results.