0
$\begingroup$

From a discussion on a stack about the programing, I got the following mathematical Conjectures:

Conjectures:

Let n,m be positive integer, $S(n)$ and $CountPosbit(m)$ be as follows.

  • $S(n):=\sum_{i=1}^{n} 2^{(i-1)}$
  • $CountPosbit(m):=$Number of positive bits when m is converted to binary.

Then, the following holds;

  • (1)$CountPosbit(S(n))=n$ for all positive integer, $n$,
  • (2)For all positive integer, $m$, following holds;
    $CountPosbit(m)=n$$m \ge S(n)$

The following example is to clarify the definition of the $CountPosbit (m)$;

  • If $m=10$ in the decimal notation, then
    the binary notation of m is 1010 therefore,
    $CountPosbit(10)=2$
  • If $m=15$ in the decimal notation. then
    the binary notation of m is 1111 therefore,
    $CountPosbit(15)=4$

For the more detail of the definition of $CountPosbit$ function, refer to the Excel VBA function in Box2 below.

My questions are as follows:

My questions:

  • (Q1)Are the above conjectures (1) and (2) correct?
  • (Q2)If these are correct, please prove them.

The results of trying with the Excel VBA functions of Box 1 and 2 below are as follows. As far as I tried, no counterexample was found. The worksheet can be downloaded from here.

enter image description here

Box1: Excel VBA function for calculating S (n)

Function S_n(n)
S_n = 0
For i = 1 To n
 S_n = S_n + (2 ^ (i-1))
Next i

End Function

Box2: Excel VBA function for CountPosbit(m)

Function CountPosbit(m)
'Substituting a decimal number, this function counts the number of positive bits when the decimal number is converted to a binary number.

tmp = Convert10to2(m)
tot = Len(tmp)
cnt = 0

For i = 1 To tot
If Mid(tmp, tot - i + 1, 1) = 1 Then cnt = cnt + 1
Next i

CountPosbit = cnt
End Function


Function Convert10to2(Value) As String
'This function is for converting decimal numbers to binary numbers.
'This function was quoted from the following website.
'https://www.umayadia.com/main/Samples/Sample055Convert10and2.htm

    Dim lngBit As Long
    Dim strData As String
    Do Until (Value < 2 ^ lngBit)
        If (Value And 2 ^ lngBit) <> 0 Then
            strData = "1" & strData
        Else
            strData = "0" & strData
        End If
        lngBit = lngBit + 1
    Loop
    Convert10to2 = strData
End Function
$\endgroup$
1
  • 1
    $\begingroup$ Do you know what is the binary form of $2^i$? $\endgroup$
    – user
    Commented Mar 14, 2021 at 16:25

1 Answer 1

1
$\begingroup$

Yes. $S(n)$ is the sum of a geometric progression. $$S(n)=2^n-1$$ The binary representation of $S(n)$ is $n$ $1$-bits, since the binary representation of $2^n$ is a $1$ followed by $n$ $0$'s, and subtracting $1$ gives $n$ $1$-bits by the usual algorithm.

$\endgroup$
1
  • $\begingroup$ Thanks for the solution. Dis you use the summation formula of the equal ratio sequence, am I right? I have a more generalized prediction for this. I have formulated it here and would like to hear about it as well. $\endgroup$ Commented Mar 15, 2021 at 0:47

You must log in to answer this question.

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