eilers

20 Reputation

One Badge

9 years, 57 days

MaplePrimes Activity


These are questions asked by eilers

I have tried to compile a simple program looking for counterexamples to a conjecture by Goldbach that every odd number is a sum of a prime and twice a square. Stern gave the counterexamples 5777 and 5993 a long time ago, so this is mainly for instruction purposes.

My program

othergoldbachFCi:=proc(sieve::Array(1..10000,datatype=integer[4]))
   local i,j,M; 
   M:=10000;
   for i from 1 to M do
      if(sieve[i] mod 2=0) then 
         for j from 1 to iquo(M-i,2*i+1) do 
            sieve[i+j*(2*i+1)]:=2*iquo(sieve[i+j*(2*i+1)],2)+1;
         end do; 
         for j from 1 to floor(sqrt(M-i)) do 
            sieve[i+j*j]:=2+sieve[i+j*j] mod 2;  
         end do;
      else 
         if(sieve[i]<2) then 
            printf("%d is a counterexample\n",2*i+1); 
         end if; 
      end if; 
   end do; 
end proc;

works fine and compiles without problems. (I have to pass the array for the sieve because compiled program cannot declare memory, and it has to be 4 bytes even though I only need to use the lower 2 bit).  But the compiled version breaks with

   Error, (in compiledOGi) array index out of bounds

 

already in the first instance of the for loop. After a lot of trial and error I found out that if I replaced the line 

   sieve[i+j*j]:=2+sieve[i+j*j] mod 2;  

by

   temp:=iquo(sieve[i+j*j],2);
   sieve[i+j*j]:=2+(sieve[i+j*j]-2*temp);  

 

then the problem goes away and the compiled version works beautifully. It is not enough to do the mod 2 computation in temp, and not enough to replace mod by iquo in one line. 

This makes very little sense to me. Can anybody explain? I'm still using Maple 2016 and do not know if the issue has been resolved in Maple 2017.

 

Best,

Soren

 

That the Bernoulli numbers has z/(exp(z)-1)) as an exponentional generating functions is of course very well known. I am wondering why the gfun package doesn't seem to be able to work this out? Naive approaches like

gfun[guessgf]([seq(bernoulli(n),n=0..100)],z);

give FAIL. I would expect gfun to be able to transform the given sequence corresponding to replacing A(z) by 1/A(z), easily recognize (exp(z)-1))/z, and transform back. Perhaps the package is in need of maintenance?

Any help would be much appreciated.

Best,

Soren

 

 

I have encountered a behavior of Maple that I find hard to explain and I am hoping for help. The command

sum(floor((exp(Pi)-Pi)*n)/3^n,n=0..infinity);

was meant to be an example of "High-precision fraud" as in the 1992 paper of Borwein and Borwein, and indeed it gives 29/2 to within 531 digits. But I am unable to make Maple see this; indeed I get with evalf(%,1000)

14.50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

I find it hard to guess why Maple gets this wrong, actually. The point of the example is that floor((exp(Pi)-Pi)*n)=20*n-1 for many n, but Maple has no problems finding the first failure at n=1112. It must hence be trying something more advanced than just adding up all summands until the tail sum is small enough to satisfy the precision? I guess an alternative approach would indeed be possible since what is being "floored" is relatively simple, but then that seems to be buggy?

Would be very grateful for any assistance!

Best,

Soren Eilers

 

 

 

Page 1 of 1