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

A244159 Semigreedy Catalan Representation of nonnegative integers.

Original entry on oeis.org

0, 1, 10, 11, 12, 100, 101, 110, 111, 112, 121, 122, 123, 211, 1000, 1001, 1010, 1011, 1012, 1100, 1101, 1110, 1111, 1112, 1121, 1122, 1123, 1211, 1212, 1221, 1222, 1223, 1232, 1233, 1234, 1322, 2111, 2112, 2121, 2122, 2123, 2211, 10000
Offset: 0

Views

Author

Antti Karttunen, Jun 23 2014

Keywords

Comments

Algorithm for constructing the sequence: Define a(0) as 0, and for larger values of n, find first the largest Catalan number which is less than or equal to n [which is A081290(n)], and the index k = A244160(n), of that Catalan number. Initialize a vector of k zeros, [0, 0, ..., 0]. Set n_remaining = n - A000108(k) and add 1 to the leftmost element of vector, so that it will become [1, 0, ..., 0]. Then check whether the previous Catalan number, C(m) = A000108(m), where m = k-1, exceeds the n_remaining, and provided that C(m) <= n_remaining, then set n_remaining = n_remaining - C(m) and increment by one the m-th element of the vector (where the 1st element is the rightmost), otherwise just decrement m by one and keep on doing the same with lesser and lesser Catalan numbers, and whenever it is possible to subtract them from n_remaining (without going less than zero), do so and increment the corresponding m-th element of the vector, as long as either n_remaining becomes zero, or after subtracting C(1) = 1 from n_remaining, it still has not reached zero. In the latter case, find again the largest Catalan number which is less than or equal to n_remaining, and start the process again. However, after a finite number of such iterations, n_remaining will finally reach zero, and the result of a(n) is then the vector of numbers constructed, concatenated together and represented as a decimal number.
This shares with "Greedy Catalan Base" (A014418) the property that a simple weighted sum of Sum_{k=1..} digit(k)*C(k) recovers the natural number n, which the given numeral string like A014418(n) or here, a(n), represents. (Here C(k) = the k-th Catalan number, A000108(k), and digit(1) = the digit in the rightmost, least significant digit position.)
In this case, A244158(a(n)) = n holds for only up to 33603, after which comes the first representation containing a "digit" larger than nine, at a(33604), where the underlying string of numbers is [1,2,3,4,5,6,7,8,9,10] but the decimal system used here can no more unambiguously represent them.
On the other hand, with the given Scheme-functions, we always get n back with: (CatBaseSumVec (A244159raw n)).
For n >= 1, A014138(n) gives the positions of repunits: 1, 11, 111, 1111, ...
The "rep-2's": 22222, 222222, 2222222, 22222222, 222222222, ..., etc., occur in positions 128, 392, 1250, 4110, 13834, ... i.e. 2*A014138(n) for n >= 5.

Examples

			For n = 18, the largest Catalan number <= 18 is C(4) = 14.
Thus we initialize a vector of four zeros [0, 0, 0, 0] and increment the first element to 1: [1, 0, 0, 0] and subtract 14 from 18 to get the remainder 4.
We see that the next smaller Catalan number, C(3) = 5 is greater than 4, so we cannot subtract it without going negative, so the second leftmost element of the vector stays as zero.
We next check C(2) = 2, which is less than 4, thus we increment the zero at that point to 1, and subtract 4 - 2 to get 2.
We compare 2 to C(1) = 1, and as 1 <= 2, it is subtracted 2-1 = 1, and the corresponding element in the vector incremented, thus after the first round, the vector is now [1, 0, 1, 1], and n remaining is 1.
So we start the second round because n has not yet reached the zero, and look for the largest Catalan number <= 1, which in this case is C(1) = 1, so we subtract it from remaining n, and increment the element in the position 1, after which n has reached zero, and the vector is now [1, 0, 1, 2], whose concatenation as decimal numbers thus yields a(18) = 1012.
		

Crossrefs

Cf. A014418 (a classical greedy variant), A244231 (maximum "digit value"), A244232 (sum of digits), A244233 (product of digits), A244314 (positive terms which have at least one zero digit), A244316 (the one-based position of digit incremented last in the described process).
Differs from A239903 for the first time at n=10, where a(10) = 121, while A239903(10) = 120.

Formula

If A176137(n) = 1, a(n) = A007088(A244230(n)), otherwise a(n) = A007088(A244230(n)-1) + a(n-A197433(A244230(n)-1)).
For all n, a(A197433(n)) = A007088(n).
For all n >= 1, a(A000108(n)) = 10^(n-1).
Each a(A014143(n)) has a "triangular" representation [1, 2, 3, ..., n, n+1].

A244232 Sum of "digit values" in Semigreedy Catalan Representation of n, A244159.

Original entry on oeis.org

0, 1, 1, 2, 3, 1, 2, 2, 3, 4, 4, 5, 6, 4, 1, 2, 2, 3, 4, 2, 3, 3, 4, 5, 5, 6, 7, 5, 6, 6, 7, 8, 8, 9, 10, 8, 5, 6, 6, 7, 8, 6, 1, 2, 2, 3, 4, 2, 3, 3, 4, 5, 5, 6, 7, 5, 2, 3, 3, 4, 5, 3, 4, 4, 5, 6, 6, 7, 8, 6, 7, 7, 8, 9, 9, 10, 11, 9, 6, 7, 7, 8, 9, 7, 8, 8, 9, 10, 10, 11, 12, 10, 11, 11, 12, 13, 13, 14, 15, 13, 10, 11, 11, 12, 13, 11, 6, 7, 7, 8, 9, 7, 8, 8, 9, 10, 10, 11, 12, 10, 7, 8, 8, 9, 10, 8, 9, 9, 10, 11, 11, 12, 1
Offset: 0

Views

Author

Antti Karttunen, Jun 25 2014

Keywords

Comments

Note that a(33604) = A000217(10) = 55 because the sum is computed from the underlying list (vector) of numbers, and thus is not subject to any corruption by decimal representation as A244159 itself is.
Equivalent description: partition n "greedily" as terms of A197433, i.e. n = A197433(i) + A197433(j) + ... + A197433(k), always using the largest term of A197433 that still "fits in" (i.e. is <= n remaining). Then a(n) = A000120(i) + A000120(j) + ... + A000120(k).

Examples

			For n=18, using the alternative description, we see that it is partitioned  into the terms of A197433 as a greedy sum A197433(11) + A197433(1) = 17 + 1. Thus a(18) = A000120(11) + A000120(1) = 3+1 = 4.
For n=128, we see that is likewise represented as A197433(31) + A197433(31) = 64 + 64. Thus a(128) = 2*A000120(31) = 10.
		

Crossrefs

Formula

If A176137(n) = 1, a(n) = A000120(A244230(n)), otherwise a(n) = A000120(A244230(n)-1) + a(n-A197433(A244230(n)-1)).
For all n, a(A000108(n)) = 1. [And moreover, Catalan numbers, A000108, give all such k that a(k) = 1].
For all n, a(A014138(n)) = n and a(A014143(n)) = A000217(n+1).

A244231 Maximum "digit" value in Semigreedy Catalan Representation of n, A244159.

Original entry on oeis.org

0, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 3, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 3, 4, 3, 2, 2, 2, 2, 3, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 3, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 3, 4, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 3, 4, 3, 3, 3, 3, 4, 4, 4, 5, 4, 3, 3, 3, 3, 4, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 3, 4, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 3, 1
Offset: 0

Views

Author

Antti Karttunen, Jun 25 2014

Keywords

Comments

The first value larger than nine occurs at a(33604) = 10. (33604 = A014143(9)). Note that this sequence is not subject to any corruption by decimal representation as A244159 itself is.
A014143 gives records up to that A014143(9) = 33604, but thereafter, the next record occurs at 57317, for which a(57317) = 11, although A014143(10) = 116103. This is explained by that A244159raw(57317) = [2,3,4,5,6,7,8,9,10,11] and A244159raw(116103) = [1,2,3,4,5,6,7,8,9,10,11] (where A244159raw means the underlying representation, before it is maimed by the decimal representation).
This change is explained by the fact that A014143(n-1) + A014138(n) > A000108(n+1) for n = 1..9, but for n >= 10, A014143(n-1) + A014138(n) < A000108(n+1).
For example, although 16808 = 2*C(9) + 3*C(8) + 4*C(7) + 5*C(6) + 6*C(5) + 7*C(4) + 8*C(3) + 9*C(2) + 10*C(1), its representation in A244159 system is 1000000123, as 16808 = 1*C(10) + 1*C(3) + 2*C(2) + 3*C(1).

Crossrefs

Programs

Formula

For all n, a(A000108(n)) = 1.
For all n >= 1, a(A014138(n)) = 1.
For all n, a(A014143(n)) = n+1.

A244233 Product of "digit values" in Semigreedy Catalan Representation of n, A244159.

Original entry on oeis.org

1, 1, 0, 1, 2, 0, 0, 0, 1, 2, 2, 4, 6, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 6, 2, 4, 4, 8, 12, 12, 18, 24, 12, 2, 4, 4, 8, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 6, 2, 4, 4, 8, 12, 12, 18, 24, 12, 2, 4, 4, 8, 12, 4, 8, 8, 16, 24, 24, 36, 48, 24, 36, 36, 54, 72, 72, 96, 120, 72, 24, 36, 36, 54, 72, 36, 2, 4, 4, 8, 12, 4, 8, 8, 16, 24, 24, 36, 48, 24, 4, 8, 8, 16, 24, 8, 16, 16, 32, 48, 48, 72, 0
Offset: 0

Views

Author

Antti Karttunen, Jun 25 2014

Keywords

Comments

Note that a(33604) = 10! = 3628800 because the product is computed from the underlying list (vector) of numbers, and thus is not subject to any corruption by decimal representation as A244159 itself is.

Crossrefs

A244314 gives the positions of zeros.

Programs

Formula

For all n, a(A014138(n)) = 1 and a(A014143(n)) = A000142(n+1).

A244314 Nonnegative integers m such that the Semigreedy Catalan representation A244159(m) contains at least one zero.

Original entry on oeis.org

0, 2, 5, 6, 7, 14, 15, 16, 17, 18, 19, 20, 21, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157
Offset: 0

Views

Author

Antti Karttunen, Jun 25 2014

Keywords

Comments

Starting offset is zero because A244159(0) = 0 is a borderline case (either one zero, or no zeros if leading zeros are discarded).
From a(1)=2 onward the positions of zeros in A244233.
After zero consists of successive subsequences containing terms from A000108(k) to (A000108(k)+A014138(k-2)-1) computed from k >= 2 onward, as: [2], [5,6,7], [14 .. 21], [42 .. 63], [132 .. 195], [429 .. 624], [1430 .. 2054], [4862 .. 6916], etc.

Crossrefs

Programs

Formula

a(0) = 0, a(1) = 2, and for n >= 2, a(n) = n + A000108(1+A244317(n)) - A014143(A244317(n)-2) - 1.

A244316 a(0) = 0, after which, if A176137(n) = 1, a(n) = A001511(A244230(n)), otherwise a(n) = a(n-A197433(A244230(n)-1)).

Original entry on oeis.org

0, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 3, 4, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 3, 4, 1, 2, 1, 1, 3, 5, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 3, 4, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 3, 4, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 3, 4, 1, 2, 1, 1, 3, 5, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 1, 3, 4, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 1, 6
Offset: 0

Views

Author

Antti Karttunen, Jun 25 2014

Keywords

Comments

For n >= 1, a(n) tells the one-based position of the digit (from the right) where the iteration stopped at, when constructing a Semigreedy Catalan representation of n as described in A244159.
Algorithm for constructing the sequence: Find the largest Catalan number which is less than or equal to n (this is A081290(n) = A000108(k), where k = A244160(n), that is, the corresponding index of that Catalan number), and subtract that from n. Then check whether the previous Catalan number, C(m) = A000108(m), where m = k-1, exceeds the remaining n, and if it does not, then subtract that also from n, and keep on doing the same for lesser and lesser Catalan numbers, comparing and also subtracting them (whenever it is possible without going less than zero) from n, until either n becomes zero, or after subtracting C(1) = 1 from n, it still has not reached zero. In the latter case, find again the largest Catalan number which is less than or equal to remaining n, and start the process again. However, when at some point n finally reaches zero, then the index k of the last Catalan number, A000108(k) which was subtracted from n before it reached zero, is our result, a(n) = k. [Here n = the original value of n, from which we started subtracting initially from].
If n is one of the terms of A197433, meaning that if it can be represented as a sum of distinct Catalan numbers as n = C(i) + C(j) + ... + C(k) (which representation then necessarily is unique), then a(n) = min(i,j,...,k).

Crossrefs

Formula

a(0) = 0, and for n >= 1, if A176137(n) = 1, a(n) = A001511(A244230(n)), otherwise a(n) = a(n-A197433(A244230(n)-1)).
For n >= 1, a(n) = A244315(n)+1.
For n >= 1, a(A000108(n)) = n and a(A014138(n)) = a(A014143(n)) = 1.

A185943 Riordan array ((1/(1-x))^m, x*A000108(x)), m = 2.

Original entry on oeis.org

1, 2, 1, 3, 3, 1, 4, 7, 4, 1, 5, 16, 12, 5, 1, 6, 39, 34, 18, 6, 1, 7, 104, 98, 59, 25, 7, 1, 8, 301, 294, 190, 92, 33, 8, 1, 9, 927, 919, 618, 324, 134, 42, 9, 1, 10, 2983, 2974, 2047, 1128, 510, 186, 52, 10, 1, 11, 9901, 9891, 6908, 3934, 1887, 759, 249, 63, 11, 1
Offset: 0

Views

Author

Vladimir Kruchinin, Feb 07 2011

Keywords

Examples

			Array begins
  1;
  2,   1;
  3,   3,   1;
  4,   7,   4,   1;
  5,  16,  12,   5,   1;
  6,  39,  34,  18,   6,   1;
  7, 104,  98,  59,  25,   7,   1;
  8, 301, 294, 190,  92,  33,   8,   1;
Production matrix begins:
   2, 1;
  -1, 1, 1;
   1, 1, 1, 1;
   0, 1, 1, 1, 1;
   0, 1, 1, 1, 1, 1;
   0, 1, 1, 1, 1, 1, 1;
   0, 1, 1, 1, 1, 1, 1, 1;
   0, 1, 1, 1, 1, 1, 1, 1, 1;
   ... _Philippe Deléham_, Sep 20 2014
		

Crossrefs

Cf. A091491 (m=1), A185944 (m=3), A185945 (m=4).
Row sums A014140. Cf. A000108, A014143.

Programs

  • Mathematica
    r[n_, k_, m_] := k*Sum[ Binomial[i + m - 1, m - 1]*Binomial[2*(n - i) - k - 1, n - i - 1]/(n - i), {i, 0, n - k}]; r[n_, 0, 2] := n + 1; Table[r[n, k, 2], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Dec 13 2012, from formula *)
  • Sage
    @CachedFunction
    def A(n, k):
        if n==k: return n+1
        return add(A(n-1, j) for j in (0..k))
    A185943 = lambda n,k: A(n, n-k)
    for n in (0..7) :
         print([A185943(n, k) for k in (0..n)])  # Peter Luschny, Nov 14 2012

Formula

R(n,k,m) = k*Sum_{i=0..n-k} binomial(i+m-1, m-1)*binomial(2*(n-i)-k-1, n-i-1)/(n-i), m = 2, k > 0.
R(n,0,2) = n + 1.
Conjecture: R(n,1,2) = A014140(n-1). R(n,2,2) = A014143(n-2). - R. J. Mathar, Feb 11 2011

A104495 Matrix inverse of triangle A099602, read by rows, where row n of A099602 equals the inverse binomial transform of column n of the triangle of trinomial coefficients (A027907).

Original entry on oeis.org

1, -1, 1, 1, -2, 1, -1, 3, -4, 1, 1, -4, 12, -5, 1, -1, 5, -34, 17, -7, 1, 1, -6, 98, -51, 32, -8, 1, -1, 7, -294, 149, -124, 40, -10, 1, 1, -8, 919, -443, 448, -164, 61, -11, 1, -1, 9, -2974, 1362, -1576, 612, -298, 72, -13, 1, 1, -10, 9891, -4336, 5510, -2188, 1294, -370, 99, -14, 1, -1, 11, -33604, 14227, -19322, 7698
Offset: 0

Views

Author

Paul D. Hanna, Mar 11 2005

Keywords

Comments

Row sums are A104496. Absolute row sums form A014137 (partial sums of Catalan numbers). Column 2 is signed A014143.

Examples

			Rows begin:
1;
-1,1;
1,-2,1;
-1,3,-4,1;
1,-4,12,-5,1;
-1,5,-34,17,-7,1;
1,-6,98,-51,32,-8,1;
-1,7,-294,149,-124,40,-10,1;
1,-8,919,-443,448,-164,61,-11,1;
-1,9,-2974,1362,-1576,612,-298,72,-13,1; ...
		

Crossrefs

Programs

  • PARI
    {T(n,k)=local(X=x+x*O(x^n),Y=y+y*O(y^k));polcoeff(polcoeff( (1+X*Y/(1+X))/(1+X-Y^2*(1-(1+4*X)^(1/2))^2/4),n,x),k,y)}

Formula

G.f.: A(x, y) = (1 + x*y/(1+x))/(1+x - x^2*y^2*Catalan(-x)^2), also G.f.: Column_k(x) = Catalan(-x)^(2*[k/2])/(1+x)^[(k+3)/2], where Catalan(x)=(1-(1-4*x)^(1/2))/(2*x) (cf. A000108).

A244317 n occurs A014138(n) times.

Original entry on oeis.org

0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6
Offset: 0

Views

Author

Antti Karttunen, Jul 18 2014

Keywords

Comments

For n >= 1, a(n) = 1 + the least k such that A014143(k) >= n.
Useful when computing A244314.

Crossrefs

Programs

  • Mathematica
    Join[{0},Flatten[Table[#[[2]],#[[1]]]&/@With[{nn=6},Thread[{Join[Accumulate[ CatalanNumber[ Range[ nn]]]],Range[nn]}]]]] (* Harvey P. Dale, Sep 06 2023 *)
  • Scheme
    (define (A244317 n) (if (zero? n) n (let loop ((k 0)) (if (>= (A014143 k) n) (+ 1 k) (loop (+ 1 k))))))

Formula

For all n >= 0, a(A014143(n)) = n+1 and a(1+A014143(n)) = n+2.

A200965 Triangle T(n,k) = coefficient of x^n in expansion of ((1-sqrt(1-4*x))/((1-x)*2))^k = sum(n>=k, T(n,k) * x^n).

Original entry on oeis.org

1, 2, 1, 4, 4, 1, 9, 12, 6, 1, 23, 34, 24, 8, 1, 65, 98, 83, 40, 10, 1, 197, 294, 273, 164, 60, 12, 1, 626, 919, 891, 612, 285, 84, 14, 1, 2056, 2974, 2938, 2188, 1195, 454, 112, 16, 1, 6918, 9891, 9846, 7698, 4677, 2118, 679, 144, 18, 1, 23714, 33604, 33549
Offset: 1

Views

Author

Vladimir Kruchinin, Nov 25 2011

Keywords

Comments

Triangle T(n,k)=
1. Riordan Array (1,(1-sqrt(1-4*x))/((1-x)*2)) without first column.
2. Riordan Array ((1-sqrt(1-4*x))/((1-x)*2*x),(1-sqrt(1-4*x))/((1-x)*2)) numbering triangle (0,0).
Convolution triangle of A014137(n). - Philippe Deléham, Jan 23 2014

Examples

			Triangle:
1,
2, 1,
4, 4, 1,
9, 12, 6, 1,
23, 34, 24, 8, 1,
65, 98, 83, 40, 10, 1,
197, 294, 273, 164, 60, 12, 1
		

Crossrefs

Cf. Columns: A014137, A014143

Programs

  • Mathematica
    T[n_, k_]:= (k/n) (Binomial[-1 - k + 2 n, -1 + n] HypergeometricPFQ[{k, k - n, -n}, {1/2 + k/2 - n, 1 + k/2 - n}, 1/4]);
    Table[T[n, k], {n, 1, 9}, {k, 1, n}] // TableForm (* Peter Luschny, May 30 2022 *)
  • Maxima
    T(n,k):=k*sum((binomial(i+k-1,k-1)*binomial(2*(n-i)-k-1,n-i-1))/(n-i),i,0,n-k);

Formula

T(n,k):=k*sum(i=0..n-k, (binomial(i+k-1,k-1)*binomial(2*(n-i)-k-1,n-i-1))/(n-i)).
Showing 1-10 of 10 results.