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

A238569 Number of compositions of n avoiding any 3-term arithmetic progression.

Original entry on oeis.org

1, 1, 2, 3, 7, 11, 19, 28, 53, 83, 140, 201, 332, 486, 775, 1207, 1716, 2498, 3870, 5623, 8020, 11276, 17168, 23323, 34746, 46141, 64879, 90467, 127971, 176201, 242869, 333508, 456683, 606403, 844818, 1125922, 1496466, 2005446, 2737912, 3543506, 4824442
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 28 2014

Keywords

Examples

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

Crossrefs

Cf. A003407 (the same for permutations).
Cf. A178932 (the same for strict partitions).
Cf. A238423 (the same for consecutive 3-term arithmetic progressions).
Cf. A238571 (the same for partitions).
Cf. A238686.

Programs

  • Maple
    b:= proc(n, i, o) option remember; `if`(n=0, 1, add(
          `if`(j in o, 0, b(n-j, i union {j}, select(y->02*j-x, i)))), j=1..n))
        end:
    a:= n-> b(n, {}, {}):
    seq(a(n), n=0..30);
  • Mathematica
    b[n_, i_List, o_List] := b[n, i, o] = If[n == 0, 1, Sum[If[MemberQ[o, j], 0, b[n - j, i  ~Union~ {j}, Select[o ~Union~ (2j-i), 0<# && # <= n &]]], {j, 1, n}]]; a[n_] := b[n, {}, {}]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Feb 06 2015, translated from Maple *)

A238687 Number of partitions p of n such that no three points (i,p_i), (j,p_j), (k,p_k) are collinear, where p_i denotes the i-th part.

Original entry on oeis.org

1, 1, 2, 2, 4, 5, 6, 8, 13, 10, 18, 21, 27, 29, 41, 41, 62, 65, 77, 91, 114, 127, 151, 173, 213, 232, 279, 322, 372, 410, 491, 518, 630, 724, 814, 894, 1057, 1141, 1326, 1502, 1681, 1839, 2146, 2324, 2636, 2966, 3272, 3607, 4173, 4422, 5035, 5616, 6195, 6703
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Mar 02 2014

Keywords

Examples

			There are a(10) = 18 such partitions of 10: [6,2,1,1], [5,2,2,1], [4,4,1,1], [3,3,2,2], [8,1,1], [7,2,1], [6,3,1], [6,2,2], [5,4,1], [5,3,2], [4,4,2], [4,3,3], [9,1], [8,2], [7,3], [6,4], [5,5], [10].
		

Crossrefs

Cf. A238686 (the same for compositions).

Programs

  • Maple
    b:= proc(n, i, 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, `if`(i<1, 0, b(n, i-1, l)+
         `if`(i>n, 0, b(n-i, i, [l[], i]))))
        end:
    a:= n-> b(n, n, []):
    seq(a(n), n=0..40);
  • Mathematica
    b[n_, i_, 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, If[i < 1, 0, b[n, i - 1, l] + If[i > n, 0, b[n - i, i, Append[l, i]]]]]];
    a[n_] := b[n, n, {}];
    Table[a[n], {n, 0, 40}] (* Jean-François Alcover, May 21 2018, translated from Maple *)

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

A338271 a(n) is the number of compositions of n, b_1 + ... + b_t = n such that sqrt(b_1 + sqrt(b_2 + ... + sqrt(b_t)...)) is an integer.

Original entry on oeis.org

1, 0, 0, 2, 0, 2, 0, 2, 2, 4, 2, 6, 2, 8, 4, 14, 6, 20, 8, 28, 14, 44, 20, 66, 30, 96, 46, 146, 70, 220, 102, 326, 154, 490, 232, 740, 346, 1102, 520, 1652, 782, 2484, 1166, 3716, 1750, 5568, 2628, 8358, 3936, 12518, 5900, 18760, 8848, 28138, 13256, 42170
Offset: 1

Views

Author

Peter Kagey, Oct 19 2020

Keywords

Comments

a(n) <= Sum_{k=1..floor(sqrt(n)/2)} A338286(floor((n-4*k^2)/2)) when n is even.
a(n) <= Sum_{k=1..floor((sqrt(n) - 1)/2)} A338286(floor((n-4*k^2-4*k-1)/2)) when n is odd and greater than 1.

Examples

			(Let s(k) = sqrt(k) for brevity.)
For n = 14, the a(14) = 8 valid compositions are:
14 = 2+2+2+2+2+3+1 and 2 = s(2+s(2+s(2+s(2+s(2+s(3+s(1)))))))
14 = 1+7+2+3+1     and 2 = s(1+s(7+s(2+s(3+s(1)))))
14 = 2+1+7+3+1     and 2 = s(2+s(1+s(7+s(3+s(1)))))
14 = 2+2+1+8+1     and 2 = s(2+s(2+s(1+s(8+s(1)))))
14 = 2+2+2+2+2+4   and 2 = s(2+s(2+s(2+s(2+s(2+s(4))))))
14 = 1+7+2+4       and 2 = s(1+s(7+s(2+s(4))))
14 = 2+1+7+4       and 2 = s(2+s(1+s(7+s(4))))
14 = 2+2+1+9       and 2 = s(2+s(2+s(1+s(9))))
		

Crossrefs

Formula

a(n) = Sum_{i=k..A000196(n)} A338268(n,k).
Showing 1-5 of 5 results.