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-5 of 5 results.

A238423 Number of compositions of n avoiding three consecutive parts in arithmetic progression.

Original entry on oeis.org

1, 1, 2, 3, 7, 13, 22, 42, 81, 149, 278, 516, 971, 1812, 3374, 6297, 11770, 21970, 41002, 76523, 142901, 266779, 497957, 929563, 1735418, 3239698, 6047738, 11289791, 21076118, 39344992, 73448769, 137113953, 255965109, 477835991, 892023121, 1665227859
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 26 2014

Keywords

Comments

These are compositions of n whose second-differences are nonzero. - Gus Wiseman, Jun 03 2019

Examples

			The a(5) = 13 such compositions are:
01:  [ 1 1 2 1 ]
02:  [ 1 1 3 ]
03:  [ 1 2 1 1 ]
04:  [ 1 2 2 ]
05:  [ 1 3 1 ]
06:  [ 1 4 ]
07:  [ 2 1 2 ]
08:  [ 2 2 1 ]
09:  [ 2 3 ]
10:  [ 3 1 1 ]
11:  [ 3 2 ]
12:  [ 4 1 ]
13:  [ 5 ]
		

Crossrefs

Cf. A238424 (equivalent for partitions).
Cf. A238569 (equivalent for any 3-term arithmetic progression).

Programs

  • Maple
    # b(n, r, d): number of compositions of n where the leftmost part j
    #             does not have distance d to the recent part r
    b:= proc(n, r, d) option remember; `if`(n=0, 1,
          add(`if`(j=r+d, 0, b(n-j, j, j-r)), j=1..n))
        end:
    a:= n-> b(n, infinity, 0):
    seq(a(n), n=0..45);
  • Mathematica
    b[n_, r_, d_] := b[n, r, d] = If[n == 0, 1, Sum[If[j == r + d, 0, b[n - j, j, j - r]], {j, 1, n}]]; a[n_] := b[n, Infinity, 0]; Table[a[n], {n, 0, 45}] (* Jean-François Alcover, Nov 06 2014, after Maple *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],!MemberQ[Differences[#,2],0]&]],{n,0,10}] (* Gus Wiseman, Jun 03 2019 *)

Formula

a(n) ~ c * d^n, where d = 1.866800016014240677813344121155900699..., c = 0.540817940878009616510727217687704495... - Vaclav Kotesovec, May 01 2014

A238571 Number of partitions of n avoiding any 3-term arithmetic progression.

Original entry on oeis.org

1, 1, 2, 2, 4, 5, 6, 8, 12, 12, 19, 23, 27, 34, 43, 49, 62, 74, 88, 104, 127, 145, 176, 199, 239, 272, 324, 378, 430, 490, 583, 654, 750, 876, 988, 1112, 1291, 1441, 1642, 1877, 2121, 2358, 2682, 2977, 3365, 3830, 4237, 4734, 5357, 5868, 6590, 7398, 8182, 9049
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 28 2014

Keywords

Examples

			a(3) = 2: [2,1], [3].
a(4) = 4: [2,1,1], [2,2], [3,1], [4].
a(5) = 5: [2,2,1], [3,1,1], [3,2], [4,1], [5].
a(6) = 6: [2,2,1,1], [3,3], [4,1,1], [4,2], [5,1], [6].
a(7) = 8: [3,2,2], [3,3,1], [4,2,1], [4,3], [5,1,1], [5,2], [6,1], [7].
a(8) = 12: [3,3,1,1], [3,3,2], [4,2,1,1], [4,2,2], [4,3,1], [4,4], [5,2,1], [5,3], [6,1,1], [6,2], [7,1], [8].
		

Crossrefs

Cf. A003407 (the same for permutations).
Cf. A178932 (the same for strict partitions).
Cf. A238569 (the same for compositions).
Cf. A238433 (partitions avoiding equidistant 3-term arithmetic progressions).
Cf. A238424 (partitions avoiding three consecutive parts in arithmetic progression).
Cf. A238687.

Programs

  • Mathematica
    a[n_] := a[n] = Count[IntegerPartitions[n], P_ /; {} == SequencePosition[P, {_, i_, _, j_, _, k_, _} /; j - i == k - j, 1]];
    Table[Print[n, " ", a[n]]; a[n], {n, 0, 50}] (* Jean-François Alcover, Oct 29 2021 *)

A238686 Number of compositions c of n such that no three points (i,c_i), (j,c_j), (k,c_k) are collinear, where c_i denotes the i-th part.

Original entry on oeis.org

1, 1, 2, 3, 7, 11, 19, 30, 53, 87, 148, 219, 365, 555, 884, 1379, 2098, 3152, 4865, 7051, 10884, 15681, 23637, 34062, 50336, 72425, 105738, 149781, 217625, 308859, 440889, 623823, 885116, 1241075, 1744784, 2433371, 3401728, 4719635, 6548306, 9035003, 12472106
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Mar 02 2014

Keywords

Examples

			There are a(6) = 19 such compositions of 6: [6], [5,1], [4,2], [3,3], [2,4], [1,5], [4,1,1], [2,3,1], [1,4,1], [1,3,2], [3,1,2], [2,1,3], [1,1,4], [2,2,1,1], [1,2,2,1], [2,1,2,1], [1,2,1,2], [2,1,1,2], [1,1,2,2].
		

Crossrefs

Cf. A238687 (the same for partitions).

Programs

  • Maple
    b:= proc(n, l) local j, k, m; m:= nops(l);
          for j to m-2 do for k from j+1 to m-1 do
            if (l[m]-l[k])*(k-j)=(l[k]-l[j])*(m-k)
              then return 0 fi od od;
         `if`(n=0, 1, add(b(n-i, [l[], i]), i=1..n))
        end:
    a:= n-> b(n, []):
    seq(a(n), n=0..20);
  • Mathematica
    b[n_, l_] := Module[{j, k, m = Length[l]}, For[ j = 1, j <= m - 2, j++, For[k = j+1, k <= m - 1 , k++, If[(l[[m]] - l[[k]])*(k - j) == (l[[k]] - l[[j]])*(m - k), Return[0]]]]; If[n == 0, 1, Sum[b[n - i,  Append[l, i]], {i, 1, n}]]];
    a[n_] := b[n, {}];
    Table[a[n], {n, 0, 20}] (* Jean-François Alcover, May 21 2018, translated from Maple *)

A178932 Partitions into distinct parts where no subset of the summands is an arithmetic progression (of length 3 or more).

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 5, 6, 6, 9, 11, 11, 15, 19, 18, 26, 29, 32, 38, 48, 47, 62, 68, 79, 89, 108, 110, 135, 152, 166, 191, 223, 237, 275, 306, 345, 380, 429, 472, 537, 588, 650, 721, 808, 902, 972, 1083, 1205, 1316, 1450, 1617, 1742, 1919, 2130, 2312, 2531
Offset: 0

Views

Author

David S. Newman, Dec 30 2010

Keywords

Comments

a(0) = 1 as is common practice with partitions.

Examples

			There are 4 partitions of 6 into distinct parts, 6, 5+1, 4+2, and 3+2+1.  Since 3+2+1 contains the arithmetic progression 3,2,1, it won't be counted here.  Thus a(6)=3.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := If[n == 0, 1, Select[IntegerPartitions[n],
         With[{u = Union[#]}, Length[#] == Length[u] &&
         SequencePosition[u, {b_, _, c_, _, d_} /;
         b-c == c-d, 1] == {}]&] // Length];
    Table[an = a[n]; Print[n, " ", an]; an, {n, 0, 60}] (* Jean-François Alcover, Aug 20 2021 *)
  • Sage
    has_arith_prog = lambda x, size: any(len(set(differences(c))) <= 1 for c in Combinations(x,size))
    A178932 = lambda n: Partitions(n,max_slope=-1).filter(lambda p: not has_arith_prog(sorted(p),3)).cardinality() # [D. S. McNeil, Dec 31 2010]

A238432 Number of compositions of n avoiding equidistant 3-term arithmetic progressions.

Original entry on oeis.org

1, 1, 2, 3, 7, 13, 22, 41, 74, 133, 233, 400, 714, 1209, 2091, 3591, 6089, 10316, 17477, 29413, 49515, 82474, 137659, 228461, 377936, 623710, 1025445, 1680418, 2746242, 4474654, 7270430, 11774128, 19020802, 30640812, 49222427, 78857338, 126033488, 200872080
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Mar 01 2014

Keywords

Examples

			The a(5) = 13 such compositions are:
01:  [ 1 1 2 1 ]
02:  [ 1 1 3 ]
03:  [ 1 2 1 1 ]
04:  [ 1 2 2 ]
05:  [ 1 3 1 ]
06:  [ 1 4 ]
07:  [ 2 1 2 ]
08:  [ 2 2 1 ]
09:  [ 2 3 ]
10:  [ 3 1 1 ]
11:  [ 3 2 ]
12:  [ 4 1 ]
13:  [ 5 ]
Note that the first and third composition contain the progression 1,1,1, but not in equidistant positions.
		

Crossrefs

Cf. A238433 (same for partitions).
Cf. A238569 (compositions avoiding any 3-term arithmetic progression).
Cf. A238423 (compositions avoiding three consecutive parts in arithmetic progression).
Cf. A238686.

Programs

  • Maple
    b:= proc(n, l) local j;
          for j from 2 to iquo(nops(l)+1, 2) do
          if l[1]-l[j]=l[j]-l[2*j-1] then return 0 fi od;
         `if`(n=0, 1, add(b(n-i, [i, l[]]), i=1..n))
        end:
    a:= n-> b(n, []):
    seq(a(n), n=0..20);
  • Mathematica
    b[n_, l_] := b[n, l] = Module[{j}, For[j = 2, j <= Quotient[Length[l] + 1, 2], j++, If[l[[1]] - l[[j]] == l[[j]] - l[[2*j - 1]], Return[0]]]; If[n == 0, 1, Sum[b[n - i, Prepend[l, i]], {i, 1, n}]]];
    a[n_] := b[n, {}];
    Table[a[n], {n, 0, 20}] (* Jean-François Alcover, May 21 2018, translated from Maple *)
Showing 1-5 of 5 results.