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-4 of 4 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].

A244217 Numbers n less than twice the largest Catalan number that is less than or equal to n.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 8, 9, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 132, 133, 134
Offset: 1

Views

Author

Antti Karttunen, Jun 23 2014

Keywords

Comments

Equally: Numbers k such that if m is the largest Catalan number <= k [= A081290(k)], then k < 2*m.
Numbers k such that the Greedy Catalan Base representation of k (A014418(k)) starts with digit 1.

Examples

			41 is not a member, because the largest Catalan number less than or equal to 41 is C(4) = 14, and 41 is not less than 2*14 = 28.
42 is a member, because the largest Catalan number less than or equal to 42 is C(5) = 42 itself, and 42 certainly is less than 2*42 = 84.
See also the examples given for the complement of this sequence: A244216.
		

Crossrefs

Positions of nonzeros in A244215.
Complement of A244216.
Cf. A000108 (a subsequence), A014418, A081290, A244314.

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

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.
Showing 1-4 of 4 results.