0
$\begingroup$

It is an exercise(P62 Problem 18) in his The Art of Computer Programming. Vol 1:Foundamental Algorithms.

Definition:If $a^p|m$,but $a^{p+1}\nmid m$,We denote $a^p||m$.

Prove or disprove:

If $2^p||n$,Let S be the numerator of $\sum_{i=1}^n \frac{1}{2i-1}$,then $2^{2p}||S$.

Example:

$n=4$ Then $p=2,S=176,2^{2p}=16,16||176$.

My efforts(Have not solved yet).

1.Note that $\sum_{i=1}^n {(2i-1)}=n^2$.(Fail to go on)

2.Programme in C and here is my code.(Compiled in Dev-CPP),no counterexamples are found.

#include 
#include 
#include 
#include 
#include 
int getpower(int number,int base,int *num);
int getrem(int h,int n,int num);


int main(int argc, char *argv[]) {
  int base,n;//In this case,base is 2.
  int h=1;
  int m=0;
  int num;
  int cnt=1;
  char ch;
  FILE *open=fopen("D:\\output.txt","w");//output it into file
  printf("Input 'ESC' to quit,press other keys go on.\n");
  while(1)
  {
   if(kbhit())
   {
    ch=getch();
    if(ch == 27)//ESC ASCII
    {
    printf("Quit.\n");
    break;  
    }
  fprintf(open,"%d Data output.\n",cnt++);
  printf("Please input base,n:\n");
  scanf("%d %d",&base,&n);
  getchar();
  fprintf(open,"base=%d,n=%d\n",base,n);
  getpower(n,base,&num);
  num*=num;//change 2^p to 2^2p.
 /*
Input base=2  n=48
Output m=4  num=16
*/
  for(h=1;h<=n;h++)
  {
    m+=getrem(h,n,num);
    printf("m=%d\n",m);
    m%=num;
  }
  if(m == 0)
  {
    fprintf(open,"Success.\n");
    printf("Success.\n");
  }
  else
  {
    fprintf(open,"Fail.\n");
    printf("Fail.\n");
  }
  printf("Input 'ESC' to quit,press other keys go on.\n");
 }//kbhit
}
fclose(open);
return 0;
} 
 int getpower(int number,int base,int *num)
 {
  //We write number in the form number=(base^p)*a,base does not divide a.The function returns p.
  int h=number;
  int rem=number%base;
  int cnt=0;
  while(!rem)
  {
    number/=base;
    cnt++;
    rem=number%base; 
  }
  *num=h/number;
  return cnt;
 } 

  int getrem(int h,int n,int num)
 {
//we multiply mul=1*3*5*...*(2h-3)*(2h+1)...*(2n-1) and calculate the remainder:mul%(base^power).
 int cnt;
 int mul=1;
 for(cnt=1;cnt<=n;cnt++)
  {
    if(cnt == h)
      continue;//We do not need to multiply h;
    else
    {
      mul*=(2*cnt-1);
      if(mul>=num)
        mul%=num;   
    }
}
return mul;
 }

1 Answers 1

2

Hint. $$\sum_{i=1}^n \frac{1}{2i-1}=\frac 1 2\sum_{i=1}^n\frac{2n}{(2i-1)(2(n+1-i)-1)}$$ So what remains is to prove the numerator of $$\sum_{i=1}^n\frac 1{(2i-1)(2n-2i+1)}$$ is divisible and at most divisible by $2^p$. But $(2i-1)(2n-2i+1) \equiv -(2i-1)^2\pmod{2^{p+1}}$. Divide $1,3,\cdots,2n-1$ into $n/2^p$ subsets of consecutive $2^p$ numbers, e.g. $\{1,3,\cdots,2^p-1\}$, $\{2^p+1,\cdots, 2\cdot 2^p-1\}$, etc. Then each subset consists of exactly all the units of the ring $\mathbb Z/2^{p+1}\mathbb Z$. Finally use the famous combinatorial identity $\sum_{i=1}^n i^2=n(n+1)(2n+1)/6$.

  • 2
    Not quite. For $n = 12$, $\mathbb{Z}/2^{2p}\mathbb{Z}$ has eight units, but we get twelve fractions.2017-01-03
  • 0
    @DanielFischer Thanks for pointing out. I didn't consider it carefully :(2017-01-03
  • 0
    Now fixed (though this answer essentially differentiates from the original one).2017-01-03