You're converting from decimal to binary and back. At least in CPython, that takes quadratic time (or causes an error). Instead of int, use Decimal, after configuring for "bignum arithmetic" as shown near the end of that page. Then it takes linear time.
Representing this in Python it would be easy to reverse the string with [::-1] so that you can start at index 0 of the string for the units, index 1 of the string for tens, and so forth. We do all digits until we run out and the carry has diminished to 0.
Also, as pointed out by Kelly this may not be the fastest way since the algorithm is not in native code. When I ran this on tio.run I hit the 4s threshold close to 10^1000000. So the algorithm just scrapes in, satisfying the criteria.
San Francisco - A worldwide volunteer computing project called the Great Internet Mersenne Prime Search (GIMPS) has discovered a 12-million-digit prime number, netting $100,000 and a Cooperative Computing Award from the Electronic Frontier Foundation (EFF) for discovering a prime number of over 10 million digits.
The GIMPS PrimeNet network made the discovery on a computer at the University of California, Los Angeles (UCLA) Mathematics Department. Computing manager Edson Smith installed and maintained the GIMPS software at UCLA, and thousands of other volunteers also participated in the search process. The discovery was hailed by Time magazine as the 29th top invention of 2008.
"Thousands of people and organizations all over the world are part of GIMPS, and discovering this prime number shows how just powerful cooperative computing can be," said PrimeNet's creator, Scott Kurowski.
The winning number is the 45th known Mersenne prime, written shorthand as 2 to the power of 43,112,609, minus 1. A Mersenne number is a positive integer that is one less than a power of two. The GIMPS discovery was announced in the Fibonacci Quarterly journal in August of this year; it is the largest prime number ever discovered.
"Computers sit idle much of the time, waiting for their users do something," said Landon Curt Noll, a mathematician, astronomer, and Cisco employee who serves as the Chair of the EFF Cooperative Computing Award advisory panel. "With EFF's Cooperative Computing Awards, we aim to encourage researchers to pool their computing over the Internet and work together to share resources to solve important problems, fostering new technologies and opportunities for everyone."
GIMPS says it will give $50,000 of the award to the UCLA Mathematics Department and donate $25,000 to charity. The remainder will fund its ongoing research and awards for participants discovering new Mersenne primes.
EFF's first Cooperative Computing Award, given for a prime number of at least a million digits, was awarded nearly 10 years ago, also to a GIMPS participant. Two Cooperative Computing Awards are still up for grabs: EFF will award $150,000 to the first individual or group who discovers a prime with at least 100 million digits, and $250,000 for a prime with at least a billion digits. Prize money comes from a special donation from an individual EFF supporter, earmarked specifically for the project.
Tickets to the Pioneer Awards ceremony are $60 through Friday, October 16, and $80 afterwards. Advance tickets are available at Members of the media interested in attending should email pr...@eff.org.
[E-mail addresses have been removed from this copy of the press release. For current information on contacting us about the Cooperative Computing Awards, please see the Cooperative Computing Awards rules.]
The discovery was initially made on 26th December by a computer volunteered by Jonathan Pace, as part of the Great Internet Mersenne Prime Search (GIMPS). Pace, a 51-year old electrical engineer based in Germantown, Tennessee, has been hunting primes for over fourteen years and his belated Christmas present is eligible for a $3,000 reward from GIMPS.
The new prime number, known as M77232917, is one million digits larger than the previous record. It is also a particularly rare type of prime called a Mersenne prime, meaning that it is one less than a power of two.
The recent discovery could mean that Mersenne primes arise more often than previously thought, or that there is a random clump closer together than expected. Increasing computing power and better software is also speeding up the process.
GIMPS will continue hunting for large Mersenne primes. The next major goal to find a prime 100 million digits long, which would net a $150,000 award administered by the Electronic Frontier Foundation.
The file(s) provided above are ZIP-formatted archives, which most modern systems can natively unpack. If your computer does not unpack the archive when you double-click it, you may need to use a separate decompression program such as UnZip.
This book was a product of RAND's computing power (and patience). The tables of random numbers in the book have become a standard reference in engineering and econometrics textbooks and have been widely used in gaming and simulations that employ Monte Carlo trials. Still the largest known source of random digits and normal deviates, the work is routinely used by statisticians, physicists, polltakers, market analysts, lottery administrators, and quality control engineers.
The following persons participated in the production, testing, and preparation for publication of the tables of random digits and random normal deviates: Paul Armer, E. C. Bower, Mrs. Bernice Brown, G. W. Brown, Walter Frantz, J. J. Goodpasture, W. F. Gunning, Cecil Hastings, Olaf Helmer, M. L. Juncosa, J. D. Madden, A. M. Mood, R. T. Nash, J. D. Williams. These tables were prepared in connection with analyses done for the United States Air Force.
Early in the course of research at The RAND Corporation a demand arose for random numbers; these were needed to solve problems of various kinds by experimental probability procedures, which have come to be called Monte Carlo methods. Many of the applications required a large supply of random digits or normal deviates of high quality, and the tables presented here were produced to meet those requirements. The numbers have been used extensively by research workers at RAND, and by many others, in the solution of a wide range of problems during the past seven years.
One distinguishing feature of the digit table is its size. On numerous RAND problems the largest existing table of Kendall and Smith, 1939, would have had to be used many times over, with the consequent dangers of introducing unwanted correlations. The feasibility of working with as large a table as the present one resulted from developments in computing machinery which made possible the solving of very complicated distribution problems in a reasonable time by Monte Carlo methods. The tables were constructed primarily for use with punched card machines. With the high-speed electronic computers recently developed, the storage of such tables is usually not practical and, in fact, much larger tables than the present one are often required; these machines have caused research workers to turn to pseudo-random numbers which are computed by simple arithmetic processes directly by the machine as needed. These developments are summarized in Juncosa, 1953; Meyer, Gephart, and Rasmussen, 1954; and Moshman, 1954, where other references may be found. The Monte Carlo Method, 1951; Curtiss, 1949; Kahn and Marshall, 1953; and Kahn, 1956, discuss the uses and applications of the Monte Carlo methods and give references to other applications.
The random digits in this book were produced by rerandomization of a basic table generated by an electronic roulette wheel. Briefly, a random frequency pulse source, providing on the average about 100,000 pulses per second, was gated about once per second by a constant frequency pulse. Pulse standardization circuits passed the pulses through a 5-place binary counter. In principle the machine was a 32-place roulette wheel which made, on the average, about 3000 revolutions per trial and produced one number per second. A binary-to-decimal converter was used which converted 20 of the 32 numbers (the other twelve were discarded) and retained only the final digit of two-digit numbers; this final digit was fed into an IBM punch to produce finally a punched card table of random digits.
Production from the original machine showed statistically significant biases, and the engineers had to make several modifications and refinements of the circuits before production of apparently satisfactory numbers was achieved. The basic table of a million digits was then produced during May and June of 1947. This table was subjected to fairly exhaustive tests and it was found that it still contained small but statistically significant biases. For example, the following table[1] shows the results of three tests (described later) on two blocks of 125,000 digits:
Block 1 was produced immediately after a careful tune-up of the machine; Block 2 was produced after one month of continuous operation without adjustment. Apparently the machine had been running down despite the fact that periodic electronic checks indicated it had remained in good order.
The transformation was expected to, and did, improve the distribution in view of a limit theorem to the effect that sums of random variables modulo 1 have the uniform distribution over the unit interval as their limiting distribution. (See Horton and Smith, 1949, for a version of this theorem for discrete variates.)
These tables were reproduced by photo-offset from pages printed by the IBM model 856 Cardatype. Because of the very nature of the tables, it did not seem necessary to proofread every page of the final manuscript in order to catch random errors of the Cardatype. All pages were scanned for systematic errors, every twentieth page was proofread (starting with page 10 for both the digits and deviates), and every fortieth page (starting with page 5 for both the digits and deviates) was summed and the totals checked against sums obtained from the cards.[2]
b37509886e