a(27) in A059097: A new lower higher bound

Alonso Del Arte alonso.delarte at gmail.com
Wed Nov 23 17:02:01 CET 2005


Once I corrected my implementation of David's algorithm, I first
tested it with the first thousand integers. It instantaneously replied
with the numbers given in A059097. (At this juncture the speed
improvement is not noticeable to a human).

Next, I asked for members in the range 10^3 to 10^4. In 3 seconds
Mathematica returned {}. It took 35 seconds to check 10^4 to 10^5, and
397 seconds to check 10^5 to 10^6, which is tremendously more
efficient than my algorithm for this range. (However, I think that the
OEIS entry should have a program that actually calculates the
binomial, with a link to a faster program being of interest only to
those who wish to extend the results).

It probably would take an hour to go up 10^7, but in any case we
should be able to give Neil a very nice, large lower bound once he
returns from vacation.

Happy Thanksgiving to y'all.

Alonso

P.S. Here's a listing of my Mathematica implementation of David's algorithm:

The e(p, n) function

expoPF[p_, n_] := Module[{s, x}, x =
   n; s = 0; While[x > 0, x = Floor[x/p]; s = s + x]; s]

The f(p, n) function

expoP2nCn[p_, n_] := expoPF[p, 2*n] - 2*expoPF[p, n]

The isGood(n) function

goodQ[n_] := TrueQ[Module[{flag, i},
    flag = True; i = 2; While[flag && Prime[i] < n, If[expoP2nCn[
      Prime[i], n] > 1, flag = False]; i++]; flag]]

This should be instantaneous once the kernel is running and the
previous functions are defined:

Select[Range[1000], goodQ[#] &]

And this should be be done in less than a minute:

Timing[Select[Range[10^3, 10^4], goodQ[#] &]]






More information about the SeqFan mailing list