A sequence in which the number of positive bits is always $k$.

60 Views Asked by At

Thanks to this stack , I got the following Conjectures. My question is as follows;

My question:

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

The notations are;
Let $k$,$n$ be positive integer , $k<n$, and,

  • $Cproduct:\mathbb{R}^{k}\to \mathbb{R}$ be defined as follows;
    $$\textbf{x}=({x}_{1},\cdots,{x}_{k}) \mapsto \sum_{i=1}^{k} {2}^{({x}_{k}-1)}$$
  • $ExponentsShift_{n,k}:\mathbb{R}^{k}\to \mathbb{R}^{k}$ is defined in the Box 1, and
  • ${Exponentseq(k,i)}$ ($i=1,2\cdots {}_{n}C_{k}$)be sequence of $k$-dimensional vector, defined as follows;
    ${Exponentseq(k,1)}:=(1,2,\cdots, k)$
    ${Exponentseq(k,i)}:=ExponentsShift_{n,k}(Exponentseq(k,i-1))\ $, for $i=2\cdots, {}_{n}C_{k}$

Conjectures:

Under the above settings,

  • (1) For all $i=1,2\cdots {}_{n}C_{k}$,
    the positive bit count when $Cproduct(Exponentseq(k,i))$ is expressed in binary is $k$.
  • (2) This method covers all patterns of selecting k elements from n elements; when A is expressed in binary notation, if the $j$th bit is 1, the $j$th element shall be picked up,
    and if it is 0, the jth element shall not be picked up.

When $i = 1$, it was discussed in this stack that this Conjectures: holds for each $k$.

This prediction is a mathematical formulation of the execution result of the Box 2's Excel VBA macro † named "test()", the execution results when n = 5 and k = 3 are as follows‡; enter image description here
†.You can download this macro from here.
‡.The user-defined functions of Box 3, "Convert10to2" and "CountPosbit" were used for the calculations in the second and third columns, respectively.

That is, in case of $n=5$ and $k=3$,

  • $\textbf{x}(1):=Exponentseq(3,1):=(1,2,3)$ therefore, $Cproduct(\textbf{x}(1))=7$ in decimal notation
  • $\textbf{x}(2):=Exponentseq(3,2):={ExponentsShift}_{n,k}(\textbf{x}(1))=(1,2,4)$ therefore, $Cproduct(\textbf{x}(2))=11$ in decimal notation
  • $\textbf{x}(3):=Exponentseq(3,3):={ExponentsShift}_{n,k}(\textbf{x}(2))=(1,2,5)$ therefore, $Cproduct(\textbf{x}(3))=19$ in decimal notation
  • $\textbf{x}(4):=Exponentseq(3,4):={ExponentsShift}_{n,k}(\textbf{x}(3))=(1,3,4)$ therefore, $Cproduct(\textbf{x}(4))=13$ in decimal notation
  • $\textbf{x}(5):=Exponentseq(3,5):={ExponentsShift}_{n,k}(\textbf{x}(4))=(1,3,5)$ therefore, $Cproduct(\textbf{x}(5))=21$ in decimal notation
  • $\textbf{x}(6):=Exponentseq(3,6)={ExponentsShift}_{n,k}(\textbf{x}(5))=(1,4,5)$ therefore, $Cproduct(\textbf{x}(6))=25$ in decimal notation
  • $\textbf{x}(7):=Exponentseq(3,7):={ExponentsShift}_{n,k}(\textbf{x}(6))=(2,3,4)$ therefore, $Cproduct(\textbf{x}(7))=14$ in decimal notation
  • $\textbf{x}(8):=Exponentseq(3,8):={ExponentsShift}_{n,k}(\textbf{x}(7))=(2,3,5)$ therefore, $Cproduct(\textbf{x}(8))=22$ in decimal notation
  • $\textbf{x}(9):=Exponentseq(3,9):={ExponentsShift}_{n,k}(\textbf{x}(8))=(2,4,5)$ therefore, $Cproduct(\textbf{x}(9))=26$ in decimal notation
  • $\textbf{x}(10):=Exponentseq(3,10):={ExponentsShift}_{n,k}(\textbf{x}(9))=(3,4,5)$ therefore, $Cproduct(\textbf{x}(10))=28$ in decimal notation

and, you will find that, for all $i=1,2,3$ $Exponentseq(3,i)$ has total $3$ positive bits in the binomial notation.

As far as I tried, I couldn't find any counterexamples of the Conjectures.

Box1: Definition of the $ExponentsShift_{n,k}$

The original definition of the $ExponentsShift_{n,k}$ is Box 2's Excel VBA function "ExponentsShift(n, k, x_i())"※.

The mathematical formulation would probably be※: $$ExponentsShift_{n,k}(\textbf{x}):=H_{k,\alpha(\textbf{x})}(\textbf{x})$$

Here,

  • $\textbf{e}_{\alpha}$ is the vector such that all but the α-th component are zero and only the α-th component is 1.
  • ${f}_{k,\alpha}(\textbf{x}) := \textbf{x} + \textbf{e}_{\alpha}$
  • ${g}_{k,\alpha}({x}) := \sum_{\beta=1}^{\alpha} {x}_{\beta}\textbf{e}_{\beta} +\sum_{\beta=\alpha+1}^{k} ({x}_{\beta-1}+1)\textbf{e}_{\beta}$
  • $h_{k,\alpha}:={f}_{k,\alpha}\circ {g}_{k,\alpha}$
  • $H_{k,\alpha}:= h_{k,\alpha}\circ h_{k,\alpha+1}\circ \cdots h_{k,k}$
  • $\alpha(\textbf{x})$ is the maximum integer such that ${Pr}_{\alpha}(H_{k,\alpha}(\textbf{x})) \le n - k + \alpha$
    (${Pr}_{\alpha}(\textbf{x})$ is α-th component of the $\textbf{x}$)

※If there is a discrepancy between Box1 and Box2, please give priority to Box2.

Box2 The Excel VBA macro program †.

Sub test()
Dim x(), Exponentseq()

n = 5 'set n
k = 3  'set k

CombinationsCount = WorksheetFunction.Combin(n, k)

ReDim Exponentseq(1 To CombinationsCount)


'Set the Exponentseq(1)
   ReDim x(k)
   For j = 0 To k: x(j) = j: Next j
   Exponentseq(1) = x
      
      'Report results
            Cells(2, 4) = 1: Cells(2, 1) = Cproduct(x)
            Cells(2, 5).Resize(1, k + 1).Value = Exponentseq(1)
           
'Caluculate Exponentseq(i)
  For i = 2 To CombinationsCount
     x = ExponentsShift(n, k, x)
    Exponentseq(i) = x
    
        'Report results
            Cells(i + 1, 4) = i: Cells(i + 1, 1) = Cproduct(x)
            Cells(i + 1, 5).Resize(1, k + 1).Value = Exponentseq(i)
  Next i
  
'Display legend
  Cells(1, 4) = "i"
  For j = 0 To k: Cells(1, j + 5) = "x(i," & j & ")": Next j
  
End Sub


Function ExponentsShift(n, k, x_i())
'※This cannot be called directly from the Excel worksheet, because this function has an array variable.
'Covering all the values in the ExponentsArray.
     
    For alpa = k To 0 Step -1
        
        'Caluculating {f}_{k,\alpha}(x) = x + \mathbf{e}_{\alpha}.
        '(Increasing the exponent value. This will make "the given bit shift to the left".)
            x_i(alpa) = x_i(alpa) + 1
        
        'Caluculatuing g_k(alpa, x())
          If alpa + 1 <= k Then: x_i = g_k(alpa, x_i)

        
        'If we have overshoot while "shifting the position" of the given bit, the For-Next cycle continues.
            If x_i(alpa) <= n - k + alpa Then
                Exit For
            End If
    Next
    ExponentsShift = x_i
End Function


Function g_k(alpa, x())
'※This cannot be called directly from the Excel worksheet, because this function has an array variable.
'If we have "shifted" a bit that was not the first on the right, we have to correct the overshoot of the other bit "shifted" previously.

    k = UBound(x)

    For bta = alpa + 1 To k
        x(bta) = x(bta - 1) + 1
    Next bta

    g_k = x
End Function

†.You can download this macro from here. This macro is quoted from here with minor modifications.

Box.3 Excel user-defined functions for checking.

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