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

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

A238433 Number of partitions of n avoiding equidistant 3-term arithmetic progressions.

Original entry on oeis.org

1, 1, 2, 2, 4, 5, 6, 8, 13, 12, 19, 23, 29, 35, 45, 52, 68, 80, 98, 111, 141, 163, 198, 230, 283, 320, 376, 443, 517, 585, 719, 799, 932, 1085, 1254, 1417, 1668, 1861, 2138, 2449, 2804, 3166, 3666, 4083, 4662, 5277, 5960, 6676, 7651, 8494, 9635, 10803, 12157
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Mar 01 2014

Keywords

Examples

			The a(8) = 13 such partitions are:
01:   [ 1 1 2 4 ]
02:   [ 1 1 3 3 ]
03:   [ 1 1 6 ]
04:   [ 1 2 2 3 ]
05:   [ 1 2 5 ]
06:   [ 1 3 4 ]
07:   [ 1 7 ]
08:   [ 2 2 4 ]
09:   [ 2 3 3 ]
10:   [ 2 6 ]
11:   [ 3 5 ]
12:   [ 4 4 ]
13:   [ 8 ]
Note that the fourth partition has the arithmetic progression 1,2,3, but not in equidistant positions.
		

Crossrefs

Cf. A238432 (same for compositions).
Cf. A238571 (partitions avoiding any 3-term arithmetic progression).
Cf. A238424 (partitions avoiding three consecutive parts in arithmetic progression).
Cf. A238687.

Programs

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