A014418 Representation of n in base of Catalan numbers (a classic greedy version).
0, 1, 10, 11, 20, 100, 101, 110, 111, 120, 200, 201, 210, 211, 1000, 1001, 1010, 1011, 1020, 1100, 1101, 1110, 1111, 1120, 1200, 1201, 1210, 1211, 2000, 2001, 2010, 2011, 2020, 2100, 2101, 2110, 2111, 2120, 2200, 2201, 2210, 2211, 10000
Offset: 0
Examples
A simple weighted sum of Sum_{k} digit(k)*C(k) [where C(k) = A000108(k), and digit(1) is the rightmost digit] recovers the natural number n (which the given numeral a(n) represents) as follows: a(11) = 201, and indeed 2*C(3) + 0*C(2) + 1*C(1) = 2*5 + 0*2 + 1*1 = 11. a(126) = 30000, and indeed, 3*C(5) = 3*42 = 126.
Links
- Olivier Gérard (first 1001 terms) & Antti Karttunen, Table of n, a(n) for n = 0..16796
- Georg Cantor, Über die einfachen Zahlensysteme, Zeitschrift fur Mathematik und Physik, 14 (1869), 121-128.
- Aviezri S. Fraenkel, Systems of numeration, The American Mathematical Monthly, Vol. 92, No. 2 (Feb., 1985), pp. 105-114.
- Antti Karttunen, A few notes on A014418
Crossrefs
Cf. A014420 (gives the sum of digits), A244221 (same sequence reduced modulo 2, or equally, the last digit of a(n)), A244216, A244217, A244222, A244223, A000108, A007623, A197433, A239903, A244155, A244158, A244320, A244318, A244159 (a variant), A244161 (in base-4), A014417 (analogous sequence for Fibonacci numbers).
Programs
-
Mathematica
CatalanBaseIntDs[n_] := Module[{m, i, len, dList, currDigit}, i = 1; While[n > CatalanNumber[i], i++]; m = n; len = i; dList = Table[0, {len}]; Do[currDigit = 0; While[m >= CatalanNumber[j], m = m - CatalanNumber[j]; currDigit++]; dList[[len - j + 1]] = currDigit, {j, i, 1, -1}]; If[dList[[1]] == 0, dList = Drop[dList, 1]]; FromDigits@ dList]; Array [CatalanBaseIntDs, 50, 0] (* Robert G. Wilson v, Jul 02 2014 *)
-
Python
from sympy import catalan def a244160(n): if n==0: return 0 i=1 while True: if catalan(i)>n: break else: i+=1 return i - 1 def a(n): if n==0: return 0 x=a244160(n) return 10**(x - 1) + a(n - catalan(x)) print([a(n) for n in range(51)]) # Indranil Ghosh, Jun 08 2017
Formula
Extensions
Description clarified by Antti Karttunen, Jun 22 2014
Comments