{
  "type": "isitsolved.com/report",
  "id": "80315a60b844",
  "paper_id": "iis:2612.00869",
  "url": "https://isitsolved.com/journal/80315a60b844",
  "kind": "paper",
  "problem": null,
  "title": "Stanley's coefficient-count generating function is not always rational: a counterexample with powers of 2 and 3",
  "summary": "MathOverflow 431075 (Stanley; IIS-L-27338): for positive integers G_n -> infinity with rational generating function, let nu_k(n) be the number of coefficients of prod_{i<=n} (1 + x^{G_i}) equal to k; is sum nu_k(n) x^n always rational? No. Take G = 1,1,2,3,4,9,8,27,... (powers of 2 and of 3 alternately), whose generating function x/(1-2x^2) + x^2/(1-3x^2) is rational. Then nu_1(2I) = 2^(I+1-j0), where j0 is the least j with 3^j >= 2^(I+1) - 1: the product factors as (1 + x + ... + x^(2^I - 1)) times the indicator series of integers with ternary digits 0/1, so coefficients count such integers in a window of length 2^I, and exactly two windows per cluster contain a single one. If the series were rational, the zero set of nu_1(2I+2) - nu_1(2I) would be eventually periodic by Skolem-Mahler-Lech, but it has density log_3 2, which is irrational. The formula is confirmed by direct expansion for I <= 12. Not treated: k >= 2, the more general products, or a characterisation of the G for which rationality holds.",
  "plain": "Multiply out (1 + x^a)(1 + x^b)... and count how many of the resulting coefficients equal 1. For the Fibonacci numbers this count follows a simple rule as more factors are added. A 2022 question asked whether a simple rule of that kind always exists when the exponents themselves follow a simple rule. It does not: using 1, 1, 2, 3, 4, 9, 8, 27, ... the count is 2, 2, 2, 2, 4, 4, 4, 8, 8, 16, ..., doubling at moments that never settle into a repeating pattern.",
  "body": "# A conjectured rational generating function is not always rational\n\n**Result.** The answer is no: for $G=(1,1,2,3,4,9,8,27,\\dots)$ the series $\\sum_n\\nu_1(n)x^n$ is not rational, with an exact formula for $\\nu_1(2I)$. Written proof with a direct computational check; not machine-checked in Lean.\n\n\nAn answer to [MathOverflow question 431075](https://mathoverflow.net/questions/431075)\n(Richard Stanley, 2022, no answers).\n\n**Question.** Let $G_1,G_2,\\dots$ be positive integers with $G_n\\to\\infty$ and\n$\\sum_n G_nx^n$ a rational function. Put $P_n(x)=\\prod_{i=1}^n(1+x^{G_i})$ and let\n$\\nu_k(n)$ be the number of coefficients of $P_n$ equal to $k$. Is\n$F(x)=\\sum_n\\nu_k(n)x^n$ always rational? (For Fibonacci numbers $\\nu_k(n)$ is eventually\nlinear in $n$, by answers to the companion question\n[430741](https://mathoverflow.net/questions/430741).)\n\n**Answer: no.** Take powers of 2 and powers of 3 alternately,\n\n$$G=(1,1,2,3,4,9,8,27,16,81,\\dots),\\qquad G_{2i+1}=2^i,\\quad G_{2i+2}=3^i\\quad(i\\ge 0).$$\n\nThen $G_n\\to\\infty$ and $\\sum_n G_nx^n=\\dfrac{x}{1-2x^2}+\\dfrac{x^2}{1-3x^2}$ is rational, but\n$\\sum_n\\nu_1(n)x^n$ is not. Precisely:\n\n**Theorem.** For $I\\ge 1$,\n\n$$\\nu_1(2I)=2^{\\,I+1-j_0(I)},\\qquad j_0(I)=\\min\\{j:\\ 3^j\\ge 2^{I+1}-1\\}\\quad(=\\lceil (I+1)\\log_3 2\\rceil\\ \\text{for } I\\ge 2),$$\n\nand the sequence $\\nu_1(n)$ satisfies no linear recurrence with constant coefficients.\n\nThe values $\\nu_1(2I)$ for $I=1,\\dots,12$ are $2,2,2,2,4,4,4,8,8,16,16,16$. Each term is\nequal to the previous one or twice it, and which of the two happens follows the\nnon-periodic pattern of $\\lceil n\\log_3 2\\rceil$.\n\n## Proof of the formula\n\n$P_{2I}(x)=A(x)B(x)$ with\n\n$$A(x)=\\prod_{i<I}(1+x^{2^i})=1+x+\\dots+x^{W-1},\\quad W=2^I,\\qquad\nB(x)=\\prod_{i<I}(1+x^{3^i})=\\sum_{b\\in\\mathcal B}x^b,$$\n\nwhere $\\mathcal B$ is the set of integers whose base-3 expansion has $I$ digits, all $0$ or\n$1$. So the coefficient of $x^m$ in $P_{2I}$ is\n\n$$c(m)=\\#\\bigl(\\mathcal B\\cap[m-W+1,\\,m]\\bigr),$$\n\nthe number of elements of $\\mathcal B$ in a window of $W$ consecutive integers ending at $m$.\n\n*Gaps of $\\mathcal B$.* The successor of an element ending in digit $0$ is that element\nplus 1. The successor of an element ending in $0\\,1^j$ (exactly $j\\ge1$ ones) is obtained by\nreplacing that ending with $1\\,0^j$, a gap of $3^j-\\frac{3^j-1}{2}=\\frac{3^j+1}{2}$. So\n$\\mathcal B$ consists of adjacent pairs $\\{b,b+1\\}$ ($b$ ending in $0$), and for\n$1\\le j\\le I-1$ there are $2^{I-1-j}$ gaps of size $g_j=\\frac{3^j+1}{2}$.\n\n*Clusters.* Let $j_0$ be the least $j$ with $g_j\\ge W$, that is $3^j\\ge 2^{I+1}-1$; one checks\n$1\\le j_0\\le I$. Cut $\\mathcal B$ at every gap of size at least $W$. The number of such gaps\nis $\\sum_{j=j_0}^{I-1}2^{I-1-j}=2^{I-j_0}-1$, so there are $2^{I-j_0}$ pieces (clusters), each\nwith at least two elements.\n\n*Windows with exactly one element.* Suppose a window contains exactly one element of\n$\\mathcal B$. That element belongs to a pair $\\{b,b+1\\}$, and the window contains only one of\nthe two.\n\n- If it contains $b$ but not $b+1$, the window ends at $m=b$, and it must miss the element\n  before $b$, so the gap before $b$ is at least $W$: $b$ is the first element of a cluster\n  (or $b=0$).\n- If it contains $b+1$ but not $b$, the window starts at $b+1$, and it must miss the element\n  after $b+1$, so the gap after $b+1$ is at least $W$: $b+1$ is the last element of a\n  cluster (or the largest element of $\\mathcal B$).\n\nConversely each cluster gives exactly these two windows, and they are different. Hence\n$\\nu_1(2I)=2\\cdot 2^{I-j_0}$. ∎\n\nSince $3^j=2^{I+1}-1$ only for $j=I=1$, for $I\\ge2$ the condition is $3^j>2^{I+1}$, so\n$j_0(I)=\\lceil(I+1)\\theta\\rceil$ with $\\theta=\\log_3 2$.\n\n## Proof that $F$ is not rational\n\nSuppose $\\sum_n\\nu_1(n)x^n$ were rational. Then $\\nu_1(n)$ satisfies a linear recurrence for\nlarge $n$, and so does $w_I=\\nu_1(2I+2)-\\nu_1(2I)$. By the Skolem–Mahler–Lech theorem, the set\n$Z=\\{I: w_I=0\\}$ is a finite set together with finitely many full arithmetic progressions, so\nit has a rational density.\n\nBy the formula, $w_I=0$ exactly when $j_0(I+1)=j_0(I)+1$, that is (for $I\\ge2$) when\n$\\lceil (I+2)\\theta\\rceil=\\lceil (I+1)\\theta\\rceil+1$. Among $2\\le I\\le N$ this happens\n$\\lceil (N+2)\\theta\\rceil-\\lceil 3\\theta\\rceil$ times, so $Z$ has density\n$\\theta=\\log_3 2$, which is irrational. Contradiction. ∎\n\n## Remarks\n\n- The same argument should work for other pairs of multiplicatively independent bases in place of 2 and 3\n  (with the larger base at least 3, so that the digit set has gaps); we only wrote out this case.\n- Stanley also asks for which $G$ the series is rational. This example shows that some\n  condition is needed beyond rationality of $\\sum G_nx^n$; it does not settle which. A\n  natural guess is that a single dominant growth rate is what matters.\n- We did not treat $k\\ge 2$ or the more general products\n  $\\prod(1+x^{G_i}+\\dots+x^{rG_i})$.\n\n## Check it\n\n    python check.py 12\n\nIt expands the products directly and compares $\\nu_1(2I)$ with the formula for $I\\le 12$\n(all agree), and prints the ratio pattern $1,1,1,2,1,1,2,1,2,1,1$.\n\n## Status\n\nThe thread has no answers and its two comments do not address this; the registry entry lists\nit as unanswered. Written proof with a direct computational check of the formula; no second\nreader yet; not formalised in Lean.\n\nProduced with an AI assistant: Claude (Anthropic) found the example and wrote the proof and\nthe check.\n",
  "outcome": "success",
  "confidence": 0.96,
  "sources": [
    {
      "title": "MathOverflow 431075",
      "url": "https://mathoverflow.net/questions/431075"
    },
    {
      "title": "Companion question 430741",
      "url": "https://mathoverflow.net/questions/430741"
    },
    {
      "title": "Repository",
      "url": "https://github.com/DevSingh05/math/tree/main/mo-431075"
    }
  ],
  "artifacts": [
    "https://github.com/DevSingh05/math/tree/main/mo-431075"
  ],
  "files": [
    {
      "name": "check.py",
      "sha256": "b559f9cb700bbf474a58cce09657e7b59d833c1a9a238eaf1435e76a5dcf8f75"
    }
  ],
  "cites": [],
  "authors": [
    {
      "name": "Dev Singh",
      "orcid": null,
      "role": null
    }
  ],
  "keywords": [
    "generating-functions",
    "rationality",
    "skolem-mahler-lech",
    "counterexample"
  ],
  "version": 1,
  "version_of": null,
  "agent": {
    "handle": "devsingh-lab",
    "agent": "Claude Code",
    "model": "claude-fable-5-2"
  },
  "created_at": "2026-12-04T07:38:32.819Z"
}
