10
$\begingroup$

I am interested in the following sequence which I came upon while generalizing an Integral Family.

$$A[n]$$

[0,1,5,6,13,14,18,19,29,30,34,35,42,43,47,48,61,62,66,67,74,75,79,80,90,91,95,96,103,104,108,109,125,126,130,131,138,139,143,144,154,155,159,160,167,168,172,173,186,187,191,192,199,200,204,205,215,216,220,221,228,229,233,234,253,254,258,259,266,267,271,272,282,283,287,288,295,296,300,301,314,315,319,320,327,328,332,333,343,344,348,349,356,357,361,362,378,379,383,384,391,392,396,397,407,408,412,413,420,421,425,426,439,440,444,445,452,453,457,458,468,469,473,474,481,482,486,487,509,510,514,515,522,523,527,528,538,539,543,544,551,552,556,557,570,571,575,576,583,584,588,589,599,600,604,605,612,613,617,618,634,635,639,640,647,648,652,653,663,664,668,669,676,677,681,682,695,696,700,701,708,709,713,714,724,725,729,730,737,738,742,743,762,763,767,768,775,776,780,781,791]

With $A[1]=0$.

The only thing I was able to discern was this Recurrence Relation: $$A[2^{a-1}\cdot(2n)]-A[2^{a-1}(2n-1)]=2^{1+a}-3 \tag{1}$$

Which gives, $$A[2n]-A[2n-1]=1$$ $$A[4n]-A[4n-2]=5$$ $$A[8n]-A[8n-4]=13$$

Also, the following recurrences work too:

$$A[4n]-A[4n-1]=1$$ $$A[4n]-A[4n-2]=5$$ $$A[4n]-A[4n-3]=6$$
$$A[8n]-A[8n-1]=1$$ $$A[8n]-A[8n-2]=5$$ $$A[8n]-A[8n-3]=6$$ $$A[8n]-A[8n-4]=13$$ $$A[8n]-A[8n-5]=14$$ $$A\left[8n\right]-A\left[8n-6\right]=18$$ $$A\left[8n\right]-A\left[8n-7\right]=19$$ and so on.

My Question is: Is there a Closed Form Expression for this Sequence?

My search on OEIS did not reveal anything as the sequence is not present there.

EDIT:
It seems like I had messed up with the Integral Generalization. Consider the Sequence A000120 : 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3

Which is known as the Hamming Weight of $n$.
User Greg Martin has already given a wonderful explanation for the relation of this sequence to this one.
This sequence can also be defined by the highest power $n$ of $2$ such that it divides $\binom{2n}{n}$

My Sequence was the Powers of $2$ in the Denominator of the Generalization.
Also it contained Binomial Terms in numerator so it seems what I got was the reduced denominator (as the powers of 2 got cancelled in numerator and denominator).

$\endgroup$
2
  • 2
    $\begingroup$ With these kind of sequences, there is always more one recurrence relation. That;s why we always want to deal with defined sequences. $\endgroup$
    – OnTheWay
    Commented Oct 9, 2023 at 14:29
  • 2
    $\begingroup$ You actually found a fairly simple sequence that is NOT already in the OEIS! I'm impressed. Now, add it to the OEIS. $\endgroup$ Commented Oct 10, 2023 at 10:15

2 Answers 2

22
$\begingroup$

If we split the data up into pairs of consecutive entries, we notice that the two numbers in each pair differ by $1$; so it suffices to find a formula for every $2$nd term. But in that sequence, when paired up the two numbers in each pair differ by $5$; so it suffices to find a formula for every $4$th term. But this keeps happening: the pairs in the every-$4$th term sequence differ by $13$ (these first three patterns are already recorded in the OP), the pairs in the every-$5$th term sequence differ by $29$, the pairs in the every-$6$th term sequence differ by $61$, and so on.

In other words, each binary digit of $n$ (actually of $n-1$, since the sequence starts with $n=1$) that equals $1$ contributes a fixed amount to $A(n)$, with those fixed amounts being $1,5,13,29,61,\dots$. And these are all $3$ less than powers of $2$. So each bit of $n$ that equals $1$, representing a power of $2$, ends up contributing $4$ times that power of $2$ minus $3$.

In other words, $$ A(n) = 4(n-1)-3w_2(n-1), $$ where $w_2(m)$ is the Hamming weight of $m$, namely the number of bits that equal $1$ in the binary representation of $m$.

$\endgroup$
1
  • 9
    $\begingroup$ (+1) That is quite interesting! This gives us, $$A(n)=n-1+3\sum_{k=1}^{n-1}\left\lfloor\frac{n-1}{2^{k}}\right\rfloor$$ $\endgroup$ Commented Oct 9, 2023 at 7:48
9
$\begingroup$

(not an answer but merely a 'visual' help)

The first differences are given by :

[1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 13, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 16, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 13, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 19, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 13, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 16, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 13, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 22, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 13, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 16, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 13, 1, 4, 1, 7, 1, 4, 1, 10, 1, 4, 1, 7, 1, 4, 1, 19, 1, 4, 1, 7, 1, 4, 1, 10]

with a rather neat and clear structure :

\begin{array} 1&&1&&1&&1&&1&&1&&1&&1&&1&&1&&1&&1&&1&&1\\ &&&4&&&&4&&&&4&&&&4&&&&4&&&&4\\ &&&&&7&&&&&&&&7&&&&&&&&7\\ &&&&&&&&&10&&&&&&&&&&&&&&&&10\\ &&&&&&&&&&&&&&&&&13 \end{array}

Corresponding to bof's inspired comment!

$\endgroup$
1
  • $\begingroup$ ... and Greg Martin's more precise and detailed answer! $\endgroup$ Commented Oct 9, 2023 at 7:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .